public static bool AddDistinct <T>(this IList <T> list, T value, IEqualityComparer <T> comparer) { if (CollectionUtils.ContainsValue <T>((IEnumerable <T>)list, value, comparer)) { return(false); } list.Add(value); return(true); }