public static T[] ToArray <T>(this IEnumerable <T> enumerable)
 {
     if (enumerable is ICollection <T> )
     {
         ICollection <T> is2        = (ICollection <T>)enumerable;
         T[]             localArray = new T[is2.Count];
         is2.CopyTo(localArray, 0);
         return(localArray);
     }
     using (IEnumerator <T> enumerator = enumerable.GetEnumerator())
     {
         EnumeratorToArray <T> array = new EnumeratorToArray <T>(enumerator);
         return(array.array);
     }
 }
Beispiel #2
0
 public ExplosionHelper.Surface[] ToArray()
 {
     Enumerator enumerator = new Enumerator(ref this, true);
     return EnumeratorToArray.Build(ref enumerator);
 }