c# how to sort a list
C#
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);using System;
class Program
{
static void Main()
{
string[] colors = new string[]
{
"orange",
"blue",
"yellow",
"aqua",
"red"
};
// Call Array.Sort method.
Array.Sort(colors);
foreach (string color in colors)
{
Console.WriteLine(color);
}
}
}
Also in C#:
- Title
- dynamically add rows to datagridview c#
- Category
- C#
- Title
- example HttpClient c# Post
- Category
- C#
- Title
- accessing form controls from another class c#
- Category
- C#
- Title
- c# get current date
- Category
- C#
- Title
- unity how to check object position
- Category
- C#
- Title
- switch case c# range
- Category
- C#
- Title
- check if current time is in the morning c#
- Category
- C#
- Title
- list contains type c#
- Category
- C#
- Title
- .net core convert keycollection to array
- Category
- C#
- Title
- visual c#
- Category
- C#
- Title
- c# access session in class
- Category
- C#
- Title
- unity oncollisionenter
- Category
- C#
- Title
- change canvas color uwp c#
- Category
- C#
- Title
- get query string parameter from string value c#
- Category
- C#
- Title
- increase variable C#
- Category
- C#
- Title
- .net identity seed users and roles
- Category
- C#
- Title
- unity atan value
- Category
- C#
- Title
- attribute usage c#
- Category
- C#
- Title
- strtorime online
- Category
- C#
- Title
- c# implement ienumerable t
- Category
- C#
- Title
- unity access child
- Category
- C#
- Title
- c# string list contains
- Category
- C#
- Title
- change Backcolor c#
- Category
- C#
- Title
- unity scene name get
- Category
- C#
- Title
- codecademy
- Category
- C#
- Title
- add text to combobox c#
- Category
- C#
- Title
- c# list length
- Category
- C#
- Title
- setting the parent of a transform which resides in a prefab
- Category
- C#
- Title
- .netstandard distinctby iqueryable
- Category
- C#
- Title
- repeat 10 timesw c#
- Category
- C#
- Title
- combobox change datasource c#
- Category
- C#
- Title
- how to use variables in c#
- Category
- C#
- Title
- asp.net mvc return file
- Category
- C#
- Title
- moq raise event
- Category
- C#
- Title
- isGrounded script for copy
- Category
- C#
- Title
- c# ienumerable to list
- Category
- C#
- Title
- c# web form compare dates
- Category
- C#
- Title
- windows form rounded corners
- Category
- C#
- Title
- c# how to check if two lists have same values
- Category
- C#
- Title
- c# graphics draw filled rectangle
- Category
- C#
- Title
- c# float to string
- Category
- C#
- Title
- unity get number of child objects
- Category
- C#
- Title
- wpf restart application c#
- Category
- C#
- Title
- MVC company assignments
- Category
- C#
- Title
- c# close window
- Category
- C#
- Title
- split using string c#
- Category
- C#
- Title
- south african id number validation c#
- Category
- C#
- Title
- textblock line break
- Category
- C#
- Title
- clear combobox c#
- Category
- C#
- Title
- for each line in string c#
- Category
- C#
- Title
- how to instantiate a gameobject
- Category
- C#
- Title
- create new object from generic c#
- Category
- C#
- Title
- unity 3d mouse look script
- Category
- C#
- Title
- how to pass object as test case in nunit c#
- Category
- C#
- Title
- C# graph api upload file one drive
- Category
- C#
- Title
- asp textarea
- Category
- C#
- Title
- uwp file open picker
- Category
- C#
- Title
- round vector3 unity
- Category
- C#
- Title
- c# get country code
- Category
- C#
- Title
- change z value unity
- Category
- C#
- Title
- initialize matrix c#
- Category
- C#
- Title
- rotate to face direction
- Category
- C#
- Title
- c# stop loop
- Category
- C#
- Title
- c# dictionaries
- Category
- C#
- Title
- c# length of array
- Category
- C#
- Title
- how to name GameObject in c#
- Category
- C#
- Title
- remove from list based on condition c#
- Category
- C#
- Title
- c# image to byte array
- Category
- C#
- Title
- foreach c#
- Category
- C#
- Title
- send type as argument c#
- Category
- C#
- Title
- c# how to delete a file
- Category
- C#
- Title
- unity get all by tag
- Category
- C#
- Title
- console.writeline
- Category
- C#
- Title
- The type or namespace name 'Scrollbar' could not be found
- Category
- C#
- Title
- Assets/Scripts/Snake.cs(177,25): error CS1061: Type `Snake.SnakeBodyPart' does not contain a definition for `SetGridPostion' and no extension method `SetGridPostion' of type `Snake.SnakeBodyPart' could be found. Are you missing an assembly reference?
- Category
- C#
- Title
- c# creating exceptions
- Category
- C#
- Title
- c# find element in list of list
- Category
- C#
- Title
- response redirect new tab
- Category
- C#
- Title
- check connection c#
- Category
- C#
- Title
- asp.net core task iactionresult
- Category
- C#
- Title
- unity change tag in script
- Category
- C#
- Title
- c# how to refresh your binding source
- Category
- C#
- Title
- button commandfield commandargument pass textbox
- Category
- C#
- Title
- unity check tag
- Category
- C#
- Title
- c# type of generic is string
- Category
- C#
- Title
- leantween sequence
- Category
- C#
- Title
- console.writeline c#
- Category
- C#
- Title
- unity rotate around axis
- Category
- C#
- Title
- c# linq to get most recent item from IList
- Category
- C#
- Title
- insert variables into string c#
- Category
- C#
- Title
- computer
- Category
- C#
- Title
- c# object default property value
- Category
- C#
- Title
- c# how to add newline on text box
- Category
- C#
- Title
- out parameters c#
- Category
- C#
- Title
- unity get list length
- Category
- C#
- Title
- unity custom update
- Category
- C#
- Title
- C# int to hex
- Category
- C#
- Title
- sum the digits in c#
- Category
- C#
- Title
- c# remove character from string at index
- Category
- C#
- Title
- unity matchinfo
- Category
- C#