2 using System.Collections.Generic;
5 using System.Threading.Tasks;
9 public class WrappedListException : Exception
11 public WrappedListException()
15 public WrappedListException(string message)
20 public WrappedListException(string message, Exception inner)
21 : base(message, inner)
26 public class WrappedList<T>
29 private List<T> Elements;
31 public WrappedList(IList<T> List, int Start)
33 Elements = new List<T>(List);
37 public WrappedList(IList<T> List)
39 Elements = new List<T>(List);
45 if (Elements.Count <= Index)
47 throw new WrappedListException("No elements left.");
50 return Elements[Index++];
53 public T GetCurrentItem()
55 return Elements[Index];
58 public T[] GetItems(int Count)
60 if (Elements.Count - Index < Count)
62 throw new WrappedListException("Unable to read requested amount of data.");
65 T[] result = Elements.Skip<T>(Index).Take<T>(Count).ToArray<T>();
71 public T[] GetCurrentItems(int Count)
73 if (Elements.Count - Index < Count)
75 throw new WrappedListException("Unable to read requested amount of data.");
78 T[] result = Elements.Skip<T>(Index).Take<T>(Count).ToArray<T>();
83 public IEnumerable<T> GetEnumerableItems(int Count)
85 if (Elements.Count - Index < Count)
87 throw new WrappedListException("Unable to read requested amount of data.");
90 IEnumerable<T> result = Elements.Skip<T>(Index).Take<T>(Count);