示例#1
0
        public static IEnumerable <TResult> SelectMany <TResult>(this Range range, Func <int, Range> fun1, Func <int, int, TResult> fun2)
        {
            foreach (var s in range.AsEnumerable())
            {
                var range2 = fun1(s);

                foreach (var t in range2.AsEnumerable())
                {
                    yield return(fun2(s, t));
                }
            }
        }
示例#2
0
 public static IEnumerable <TResult> Select <TResult>(this Range range, Func <int, TResult> selector)
 {
     return(range.AsEnumerable().Select(selector));
 }
示例#3
0
 public static IEnumerable <TResult> Cast <TResult>(this Range range)
 {
     return(range.AsEnumerable().Cast <TResult>());
 }
示例#4
0
 public static IEnumerator <int> GetEnumerator(this Range range)
 {
     return(range.AsEnumerable().GetEnumerator());
 }
示例#5
0
 public static void Add(this ICollection <int> collection, Range range)
 {
     collection.Add(range.AsEnumerable());
 }
示例#6
0
 public static IEnumerable <int> ToArray(this Range range)
 => range.AsEnumerable().ToArray();
示例#7
0
 public static IEnumerable <TResult> SelectMany <TCollection, TResult>(this Range range, Func <int, IEnumerable <TCollection> > fun1, Func <int, TCollection, TResult> fun2)
 {
     return(Enumerable.SelectMany <int, TCollection, TResult>(range.AsEnumerable(), fun1, fun2));
 }
示例#8
0
 public static IEnumerable <TResult> SelectMany <TResult>(this Range range, Func <int, IEnumerable <TResult> > fun)
 {
     return(range.AsEnumerable().SelectMany(fun));
 }
示例#9
0
 public static IEnumerable <int> Where(this Range range, Func <int, bool> fun)
 {
     return(range.AsEnumerable().Where(fun));
 }
示例#10
0
 public static IEnumerable <int> Select(this Range range, Func <int, int> fun)
 {
     return(range.AsEnumerable().Select(fun));
 }
示例#11
0
 public static IEnumerable <int> Take(this Range range, int n)
 {
     return(range.AsEnumerable().Take(n));
 }
示例#12
0
 /// <summary>
 /// Range GetEnumerator method, allows foreach over a range as long as the indices are not from the end
 /// </summary>
 /// <param name="range">Range to get the Enumerator for</param>
 /// <returns>An enumerator over the entire range</returns>
 /// <exception cref="ArgumentException">If any of the indices are marked as from the end</exception>
 public static IEnumerator <int> GetEnumerator(this Range range) => range.AsEnumerable().GetEnumerator();