Valerie Meunier

Valerie Meunier

  • 824
  • 693
  • 72.2k

how to sort List with class object?

Aug 19 2022 5:04 PM

Hi,

List<MyClass> t = new List<MyClass>();

t.Add(new MyClass() { name = "Bob", age = 36, country = "Spain" });

   ...

t.Sort();

This doesn' work. How can i do that? Can i sort according any field?

Thanks

V.

 


Answers (2)