Sunday, May 29, 2011

C#: HasDuplicates() extension for IEnumerable

Continuing on my previous post..



public static bool HasDuplicates<T>( this IEnumerable<T> sequence ) {
if ( null == sequence ) {
throw new ArgumentNullException( "sequence" );
}
return sequence.Duplicates().Any();
}

No comments :