|
@@ -1,45 +0,0 @@
|
|
|
-using System;
|
|
|
-using System.Collections;
|
|
|
-using System.Collections.Generic;
|
|
|
-using System.Runtime.CompilerServices;
|
|
|
-
|
|
|
-namespace Vit.Extensions
|
|
|
-{
|
|
|
- /// <summary>
|
|
|
- ///
|
|
|
- /// </summary>
|
|
|
- public static partial class IEnumeratorExtensions
|
|
|
- {
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- ///
|
|
|
- /// </summary>
|
|
|
- /// <typeparam name="T"></typeparam>
|
|
|
- /// <param name="data"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
- public static List<T> IEnumerator_ToList<T>(this IEnumerator data)
|
|
|
- {
|
|
|
- var list = new List<T>();
|
|
|
- data.Reset();
|
|
|
- while (data.MoveNext())
|
|
|
- {
|
|
|
- list.Add((T)data.Current);
|
|
|
- }
|
|
|
- return list;
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- ///
|
|
|
- /// </summary>
|
|
|
- /// <typeparam name="T"></typeparam>
|
|
|
- /// <param name="data"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
- public static List<T> IEnumerable_ToList<T>(this System.Collections.IEnumerable data) //ICollection data
|
|
|
- {
|
|
|
- return data?.GetEnumerator().IEnumerator_ToList<T>();
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-}
|