Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# how to sort a list

var simpleList = new List<ObjectName>();
// Order by a property
list.OrderBy(o => o.PropertyName);
// Order by multiple property
list.OrderBy(o => o.PropertyName).ThenBy(o => o.AnotherProperty);
// Same but descending
list.OrderByDescending(o => o.PropertyName).ThenByDescending(o => o.AnotherProperty);
Comment

list sort c#

List<Order> SortedList = objListOrder.OrderBy(o=>o.OrderDate).ToList();
Comment

C# sort list<>

var users = new List<User>();
users.Add(new User("John", "Doe", 1230));
users.Add(new User("Lucy", "Novak", 670));
users.Add(new User("Ben", "Walter", 2050));
users.Add(new User("Robin", "Brown", 2300));
users.Add(new User("Amy", "Doe", 1250));
users.Add(new User("Joe", "Draker", 1190));
users.Add(new User("Janet", "Doe", 980));
users.Add(new User("Albert", "Novak", 1930));
users.Sort((u1, u2) =>
{
    int result = u1.LastName.CompareTo(u2.LastName);
    return result == 0 ? u1.Salary.CompareTo(u2.Salary) : result;
});
Comment

c# sort llist

List<Order> SortedList = objListOrder.OrderBy(o=>o.OrderDate).ToList();
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# get date without time 
Csharp :: how to keep rigidbody2D upright unity 
Csharp :: mysql: [Warning] Using a password on the command line interface can be insecure. 
Csharp :: declare string array c# without size 
Csharp :: c# sftp 
Csharp :: c# bool to int 
Csharp :: convert c# string to int 
Csharp :: c# string 
Csharp :: delete all rows from table mvc 
Csharp :: frustum 
Csharp :: cast from object to generic type c# 
Csharp :: C# loop through the registry searching for keys containing 
Csharp :: Code to disable Debug.log 
Csharp :: c sharp list 
Csharp :: take photo function in unity 
Csharp :: select distinct linq mvc 
Csharp :: Get unique id of Device 
Csharp :: unity werfen mit höhe 
Csharp :: predicate EF Core search query 
Csharp :: c# minimise form 
Csharp :: program.cs entity framework 
Csharp :: how to serialize a property in unity 
Csharp :: binding on button c# 
Csharp :: create blazor server 
Csharp :: Advertisement code for unity 
Csharp :: .net mvc foreach index 
Csharp :: how to find the biggest number in c# 
Csharp :: load information with txt file to uwp c# 
Csharp :: c# file to byte array 
Csharp :: how to pass function as paraemter of another function pythpn 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =