CSharp examples for System.Collections.Generic:IEnumerable
To Array by index on IEnumerable
using System.Collections.Generic; using System.Collections; using System;/*from w w w . ja v a2 s.com*/ public class Main{ public static T[] ToArray<T>(IEnumerable<T> list, int index, int count) { List<T> intermediate = new List<T>(list); List<T> range = intermediate.GetRange(index, count); return range.ToArray(); } public static T[] ToArray<T>(IEnumerable list) { var result = new List<T>(); foreach (var item in list) { result.Add((T)item); } return result.ToArray(); } public static T[] ToArray<T>(IEnumerable<T> list) { List<T> intermediate = new List<T>(list); return intermediate.ToArray(); } public static IList<T> GetRange<T>(IEnumerable<T> list, int index, int count) { List<T> intermediate = new List<T>(list); return intermediate.GetRange(index, count); } }