I have a List<Vehicles> which contains 4 items:
My Vehicles object has 2 properties: VehId, VehName
The 4 items in my list are:
1) VehId : "LOR", VehName : "Lorry"
2) VehId : "CAR", VehName : "Car"
3) VehId : "BOA", VehName : "Boat"
4) VehId : "PLN", VehName : "Plane"
What I’d like to do is put Car vehicle to the top of the list. How would I do this? By using .OrderBy() or .Sort()?
One way is using
Enumerable.OrderBy:here’s a demo: http://ideone.com/QAgzd