在此方法之後,我的列表計數返回0,而不應該。所有的調試都是正確的,他們都不是null或者其他東西。我正在使用Unity。 有誰知道問題在哪裏?通過for循環添加值後返回0列表 - c#
List<Coordinates> FillCoordinates()
{
List<Coordinates> coordinatesList = new List<Coordinates>();
Debug.Log(minLenght);
Debug.Log(maxLenght);
Debug.Log(heights.Count);
for (int i = minLenght; i > maxLenght; i++)
{
for (int j = 0; j < heights.Count; j++)
{
coordinatesList.Add(new Coordinates(i, heights[j]));
}
}
return coordinatesList;
}
座標類:
public class Coordinates
{
public int lenght;
public float height;
public Coordinates(int lenght_, float height_)
{
lenght = lenght_;
height = height_;
}
}
'對(INT I = minLenght; I ** <** maxLenght;我++)'' –
是Lenght'一個錯字。應該是'長度' – Itsik