列出<T>订购

Tru*_*aya 3 c# linq .net-3.5

我有一个问题,我允许用户选择criterea来订购List

让我们说我的名单被称为

List<Cars> AllCars = new List<Cars>;
allCars = //call the database and get all the cars
Run Code Online (Sandbox Code Playgroud)

我现在想订购这份清单

allCars.orderBy(registrationDate)
Run Code Online (Sandbox Code Playgroud)

我理解上面的内容不起作用,但我没有任何关于我应该放在括号中的内容.

Mar*_*ann 5

allCars.OrderBy(c => c.RegistrationDate);
Run Code Online (Sandbox Code Playgroud)