Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# list object sort alphabetically

using System.Linq;

List<MyObject> list = new List<MyObject>()
{ new MyObject("Peterson", "Mike"), new MyObject("Johnson", "Tim") };

list.OrderBy((item) => item.LastName);
// In this example, the list would be arranged like so: Johnson, Peterson
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #list #object #sort #alphabetically
ADD COMMENT
Topic
Name
7+4 =