CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets matching tags of IEqualityComparer
C#
/// <summary>
/// Add in item to a collection if it does not contain the specified element by using a IEqualityComparer<>. 
/// </summary>
/// <typeparam name="T">Type of the items in a collection</typeparam>
/// <param name="collection">The collection to add  the item</param>
/// <param name="item">The item to add to the collection</param>
/// <param name="comparer">An equality comparer to compare values.</param>
/// <returns>true if the item was added to the collection; otherwise, false.</returns>
public static bool Add<T>(this ICollection<T> collection, T item, IEqualityComparer<T> comparer)
{
by brentj   February 18, 2011 @ 7:26am
151 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate