using System.Collections.Generic;
namespace JM.LinqFaster
{
public static partial class LinqFaster
{
///
/// Generates a sequence of integral numbers within a specified range.
///
/// The value of the first integer in the sequence.
/// The number of sequential integers to generate.
/// A sequence that contains a range of sequential integral numbers.
public static int[] RangeArrayF(int start, int count)
{
long max = ((long)start) + count - 1;
if (count < 0 || max > int.MaxValue)
{
throw Error.ArgumentOutOfRange("count");
}
int[] result = new int[count];
for (int i = 0; i < result.Length; i++)
{
result[i] = i + start;
}
return result;
}
///
/// Generates a sequence of integral numbers within a specified range.
///
/// The value of the first integer in the sequence.
/// The number of sequential integers to generate.
/// A sequence that contains a range of sequential integral numbers.
public static List RangeListF(int start, int count)
{
long max = ((long)start) + count - 1;
if (count < 0 || max > int.MaxValue)
{
throw Error.ArgumentOutOfRange("count");
}
var result = new List(count);
for (int i = 0; i < count; i++)
{
result.Add(i + start);
}
return result;
}
}
}