c# Programming Glossary: keyselector
ascending/descending in LINQ - can one change the order via parameter? http://stackoverflow.com/questions/388708/ascending-descending-in-linq-can-one-change-the-order-via-parameter TKey this IEnumerable TSource source Func TSource TKey keySelector bool descending return descending source.OrderByDescending keySelector.. bool descending return descending source.OrderByDescending keySelector source.OrderBy keySelector public static IOrderedQueryable.. source.OrderByDescending keySelector source.OrderBy keySelector public static IOrderedQueryable TSource OrderByWithDirection..
Linq Distinct on a particular Property http://stackoverflow.com/questions/489258/linq-distinct-on-a-particular-property TKey this IEnumerable TSource source Func TSource TKey keySelector HashSet TKey seenKeys new HashSet TKey foreach TSource element.. TKey foreach TSource element in source if seenKeys.Add keySelector element yield return element So to find the distinct values..
Why is there no Linq method to return distinct values by a predicate? http://stackoverflow.com/questions/520030/why-is-there-no-linq-method-to-return-distinct-values-by-a-predicate TKey this IEnumerable TSource source Func TSource TKey keySelector return source.DistinctBy keySelector EqualityComparer TKey.. Func TSource TKey keySelector return source.DistinctBy keySelector EqualityComparer TKey .Default public static IEnumerable TSource.. TKey this IEnumerable TSource source Func TSource TKey keySelector IEqualityComparer TKey comparer if source null throw new ArgumentNullException..
foreach + break vs linq FirstOrDefault performance difference http://stackoverflow.com/questions/8214055/foreach-break-vs-linq-firstordefault-performance-difference IterationLookup IEnumerable TItem items Func TItem TKey keySelector this.items items.OrderByDescending keySelector .ToList public.. TItem TKey keySelector this.items items.OrderByDescending keySelector .ToList public TItem GetItem DateTime day foreach TItem i in.. IterationLookup IEnumerable TItem items Func TItem TKey keySelector this.items items.OrderByDescending keySelector .ToList public..
|