using System.Collections.Generic;
namespace JM.LinqFaster
{
public static partial class LinqFaster
{
// ------------------------ Arrays ---------------------------
///
/// Generates a sequence that contains one repeated value.
///
/// The value to be repeated.
/// The number of times to repeat the value in the generated sequence.
/// A sequence that contains a repeated value
public static T[] RepeatArrayF(T element, int count)
{
var result = new T[count];
for (int i = 0; i < result.Length; i++)
{
result[i] = element;
}
return result;
}
// ------------------------ Lists ---------------------------
///
/// Generates a sequence that contains one repeated value.
///
/// The value to be repeated.
/// The number of times to repeat the value in the generated sequence.
/// A sequence that contains a repeated value
public static List RepeatListF(T element, int count)
{
var result = new List(count);
for (int i = 0; i < count; i++)
{
result.Add(element);
}
return result;
}
}
}