public static bool IsEnumerable(this Type type, out EnumerableInfo enumerableInfo) { if (type is null) { throw new ArgumentNullException(nameof(type)); } if (!type.IsEnumerableType(out var getEnumerator)) { enumerableInfo = default; return(false); } var isEnumerator = getEnumerator.ReturnType.IsEnumeratorType(out var current, out var moveNext, out var reset, out var dispose); enumerableInfo = new EnumerableInfo(getEnumerator, new EnumeratorInfo(current, moveNext, reset, dispose)); return(isEnumerator); }
public EnumerableWrapper(TEnumerable instance, EnumerableInfo info) { Instance = instance; Info = info; }