An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
The code you've provided is unusable as it contains unknown variables and most likely the "crash" is caused by logic within the loop not the loop itself.
class Program
{
private static readonly Random _random = new Random();
static void Main(string[] args)
{
double lowPrice = 2.2d;
double Ncma = 8;
List<double> items = PopulateList(10);
items.ForEach(i => {
double value = (i - lowPrice) / (Ncma - lowPrice);
Console.WriteLine(value);
});
}
public static List<double> PopulateList(int iterations)
{
List<double> items = new List<double>();
for (int i = 0; i< iterations; i++)
{
items.Add(i + _random.Next(100));
}
return items;
}
}