A quick way of finding the first duplicate, if present, is:
public static bool TryFindFirstDuplicate(this IEnumerable source, out T duplicate)
{
var set = new HashSet();
foreach (var item in source)
{
if (!set.Add(item))
{
duplicate = item;
return true;
}
}
duplicate = default(T);
return false;
}