Daily Archives: 29/03/2018

Sorting lists in C#

Published by:

Working with lists is something developers do almost everyday. One of the most common tasks when we think about lists is sorting them. Fortunately, sorting lists in C# is not very complicated when it comes to primitive types and strings, but are slightly more complicated when we create lists of our own objects. In this tutorial we’ll go through some of the common ways to sort lists in C#.

Let’s start with a short and simple example. Let’s assume that we create a list of names and we add some names to the list:

List<string> names = new List<string>();

Continue reading