I want to add a number to a
List<double>[] distances = new List<double>[2];
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 5; j++)
{
double distance = MyFunktionthatreturnsANumber();
distances[i].Add(distance);
}
}
But everytime I try to run this code i get this error at the first passage if the loop:
System.NullReferenceException: 'Object reference not set to an instance of an object.'