Exemplo n.º 1
0
 public static void ForEach <T, TS>(this SafeSelectHashSetEnumerable <T, TS> enumerable, Action <T> action)
 {
     // [FOREACH PERFORMANCE] Should not allocate garbage
     foreach (T elem in enumerable)
     {
         action(elem);
     }
 }
Exemplo n.º 2
0
        public static List <TSelected> ToList <TSelected, TSource>(
            this SafeSelectHashSetEnumerable <TSelected, TSource> set)
        {
            List <TSelected> result = new List <TSelected>(set.Count);

            foreach (TSelected element in set)
            {
                result.Add(element);
            }

            return(result);
        }
Exemplo n.º 3
0
        public static T FirstOrDefault <T, TS>(this SafeSelectHashSetEnumerable <T, TS> enumerable)
        {
            var enumerator = enumerable.GetEnumerator();

            if (enumerator.MoveNext())
            {
                return(enumerator.Current);
            }
            else
            {
                return(default(T));
            }
        }