我有一个List,其中包含我自己创建的类元素。这是我的代码:
{
public partial class BestResultsScreen : Form
{
List<Result> my_results;
public BestResultsScreen()
{
InitializeComponent();
my_results = new List<Result>();
Result r1 = new Result();
r1.Name = "John";
r1.Points = 158;
r1.Year = 2013;
my_results.Add(r1);
Result r2 = new Result();
r2.Name = "Mia";
r2.Points = 253;
r2.Year = 2014;
my_results.Add(r2);
}
}
class Result
{
public string Name;
public int Points;
public int Year;
}
}
我可以按点排序此列表吗? 谢谢!