I'm using C# on Framework 3.5. I'm looking to quickly sort a Generic List<T>
. For the sake of this example, let's say I have a List of a Person
type with a property of lastname. How would I sort this List using a lambda expression?
List<Person> people = PopulateList();
people.OrderBy(???? => ?????)
This is a generic sorter. Called with the switch below.
dvm.PagePermissions is a property on my ViewModel of type List T in this case T is a EF6 model class called page_permission.
dvm.UserNameSortDir is a string property on the viewmodel that holds the next sort direction. The one that is actaully used in the view.
You can also use
you can use linq :) using :
You can use this code snippet:
where
New1
is aList<Employee>
.EmpList
is variable of aList<Employee>
.z
is a variable ofEmployee
type.