for (int i = 0; i < ileMiast; i++) //Dodanie tylu wierszy ile jest miast
{
odleglości.Add(new List());
for (int j = 0; j < ileMiast; j++) //Dodanie tylu kolum ile jest wierszy
{
if (i == j) odleglości.ElementAt(i).Add(0);
else odleglości.ElementAt(i).Add(null);
}
}
int x = 0, y =0, czas = 5;
odleglości.ElementAt(x).ElementAt(y) = czas; Dlaczego w ostatniej lini dostaje błąd: the left-hand side of an assignment must be a variable property or indexer?
{
List> odleglości = new List>();
for (int i = 0; i < ileMiast; i++) //Dodanie tylu wierszy ile jest miast
{
odleglości.Add(new List());
for (int j = 0; j < ileMiast; j++) //Dodanie tylu kolum ile jest wierszy
{
if (i == j) odleglości.ElementAt(i).Add(0);
else odleglości.ElementAt(i).Add(null);
}
}
int x = 0, y =0, czas = 5;
odleglości.ElementAt(x).ElementAt(y) = czas;
Dlaczego w ostatniej lini dostaje błąd: the left-hand side of an assignment must be a variable property or indexer?
#programowanie #csharp
6 = zmienna;