Reputation: 1
I had a problem with deleting a row in c# .im writing a program for sky-l program and im checking the first coloumn and then i will decide which row is smaller(the first coloumn is important) plz help me how to delete the row. this the code.
for (int f = 0; f < i; f++)
{
sortedsky[f, 0] = sky[min, 0];
sortedsky[f, 1] = sky[min, 1];
sortedsky[f, 2] = sky[min, 2];
//how to delete???
for (y = 0; y < i-1; y++)
min = 0;
if (sky[y+1, 0] < sky[min, 0])
min = y;
}
return 1;
}
Upvotes: 0
Views: 79
Reputation: 393114
I strongly suggest using a generic List (which manages an array internally)
You can get a plain array from a list:
List<Sky> listofSky;
listofSky.Add(sky1);
listofSky.Add(sky2);
listofSky.Add(sky3);
Sky[] arr = listofSky.ToArray();
List also has simple Remove methods.
Upvotes: 0
Reputation: 499062
If you need to remove items from a list, consider using a List<T>
instead of an array.
Upvotes: 2