I want to add a value multiple times at the beginning of a list, what I have is...
internal static class Helper
{
public static void Prepend(this IList<double> source, double value, int count)
{
for (var i = 0; i < count; ++i)
{
source.Insert( 0, value );
}
}
}
Then use it as follow
// create
var mylist = new List(){ ... }; // create the list
mylist.Prepend( 0, 10 ); // prepend 0 to the list
But I wonder if there isn't a more efficient way of doing the same thing?