Answers for "c# list sort descending"

C#
3

how to order an arraylist in descending order in c#

availableTags.Sort();
availableTags.Reverse();
Posted by: Guest on June-14-2021
3

list sorting c#

using System.Linq;

//sorts in acending order {1,2,3,4,5}
myList.Sort();

//Sorts in decending order {5,4,3,2,1}
myList.Sort();
myList.Reverse();

//to sort a custom list of classes you have to 
//add this inside of your class
public int CompareTo(MyClass other)//replace MyClass with your class type
{
    //replace varInClass to the variable that you would like to compare
	return this.totalScore.CompareTo(other.varInClass)
}
Posted by: Guest on December-14-2020
0

c# return list in descending order

list.OrderByDescending();
Posted by: Guest on April-14-2021

C# Answers by Framework

Browse Popular Code Answers by Language