Reverse
The Reverse query operator simply takes the input sequence and returns the elements in the reverse order in the output sequence; so, for example, the first element in the input sequence will become the last element in the output sequence.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LINQExample
{
class Program
{
static void Main(string[] args)
{
Employee[] Employees =
{
new Employee { Name = "Ramesh", salary = 500 },
new Employee { Name = "Suresh", salary = 100 },
new Employee { Name = "Yogesh", salary = 150 },
new Employee { Name = "Harish", salary = 500 },
new Employee { Name = "Vijay", salary = 100 } };
//sort elements as only by ordeby condition
IEnumerable<Employee> query1 = Employees.Reverse();
foreach (var Employee in query1)
{
Console.WriteLine("Employee Name="+Employee.Name+" Salary="+Employee.salary);
}
Console.ReadLine();
}
}
public class Employee
{
public string Name;
public int salary;
}
}
