Ordering Operators in LINQ
In this article, I am going to discuss the Ordering Operators in LINQ with examples. Please read our previous article where we discussed the Union Method in C# with examples. At the end of this article, you will learn the following two things.
- What is Ordering Operator in LINQ?
- What are the Methods in Sorting?
What is Ordering Operators?
In simple term, we can say that Ordering is nothing but a process to manage the data in a particular order. It is not changing the data or output rather this operation arranges the data in a particular order i.e. either ascending order or descending order.
In this case, the count is going to be the same but the order of the element is going to change.
We sort the data in two ways i.e. ascending or descending order. The order may be integer based or any other data type based. For example
- Name of Cities of a particular state in alphabetical order.
- Students order by Roll Number in a class.
It is also possible to order based on multiple columns like Employee First and Last Name in ascending order while the Salary is on descending order.
What are the Methods in Sorting?
There are five methods provided by LINQ to sort the data. They are as follows
In the next article, I am going to discuss the LINQ OrderBy Method with examples.