Esempio n. 1
0
        public SafeSelectHashSetEnumerator(SafeHashSetEnumerable <TSource> source, Func <TSource, TSelected> select)
        {
            this.source = source.GetEnumerator();

            this.select  = select;
            this.Current = default(TSelected);
        }
Esempio n. 2
0
 public static void ForEach <T>(this SafeHashSetEnumerable <T> enumerable, Action <T> action)
 {
     // [FOREACH PERFORMANCE] Should not allocate garbage
     foreach (T elem in enumerable)
     {
         action(elem);
     }
 }
Esempio n. 3
0
        public static List <T> ToList <T>(this SafeHashSetEnumerable <T> set)
        {
            List <T> result = new List <T>(set.Count);

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

            return(result);
        }
Esempio n. 4
0
 public SafeSelectHashSetEnumerable(SafeHashSetEnumerable <TSource> source, Func <TSource, TSelected> select)
 {
     this.source = source;
     this.select = select;
 }
Esempio n. 5
0
 public static SafeSelectHashSetEnumerable <TSelected, TSource> Cast <TSelected, TSource>(this SafeHashSetEnumerable <TSource> source) where TSelected : class
 {
     return(new SafeSelectHashSetEnumerable <TSelected, TSource>(source, val =>
     {
         object notBoxedValue = val;
         return (TSelected)notBoxedValue;
     }));
 }