I want to sort list of class objects.
class tocka
{
Point t;
double kut;
int redkotiranja;
public tocka(Point _t, double _kut, int _redkotiranja)
{
t = _t;
kut = _kut;
redkotiranja = _redkotiranja;
}
}
Here is the list:
List tocke= new List();
tocka a = new tocka(new Point(0, 1), 10, 1);
tocke.Add(a);
tocka b = new tocka(new Point(5, 1), 10, 1);
tocke.Add(b);
tocka c = new tocka(new Point(2, 1), 10, 1);
tocke.Add(c);
tocka d = new tocka(new Point(1, 1), 10, 1);
tocke.Add(d);
tocka ee = new tocka(new Point(9, 1), 10, 1);
tocke.Add(ee);
I want to sort list tocke
by t.X
How I do that in C#?
No comments:
Post a Comment