Пример #1
0
 public static IEnumerable <T> EnumReverse <T>(this IList <T> list, int beginIdx, int endIdx)
 {
     beginIdx = RangeUtils.PutInRange(-1, list.Count - 1, beginIdx);
     endIdx   = RangeUtils.PutInRange(-1, list.Count - 1, endIdx);
     for (int i = beginIdx; i > endIdx; --i)
     {
         yield return(list[i]);
     }
 }
Пример #2
0
 public static IEnumerable <T> EnumForward <T>(this IList <T> list, int beginIdx, int endIdx)
 {
     beginIdx = RangeUtils.PutInRange(0, list.Count, beginIdx);
     endIdx   = RangeUtils.PutInRange(0, list.Count, endIdx);
     for (int i = beginIdx; i < endIdx; ++i)
     {
         yield return(list[i]);
     }
 }