CSharp · Console
// C# Eval Expression
// Doc: https://eval-expression.net/linq-dynamic
// @nuget: Z.Expressions.Eval
/*
## LINQ ReserveDynamic Method
The LINQ ReserveDynamic method inverts the order of the elements in a sequence.
In this example, we will create a list of product and then we will reverse the list order.
See more: https://eval-expression.net/linq-dynamic
*/
using System;
using System.Collections.Generic;
using System.Linq;
using Z.Expressions;
public class Program
{
public static void Main()
{
var product1 = new Product() { Name = "C# Eval Expression", Url = "https://eval-expression.net/", Type = "Paid" };
var product2 = new Product() { Name = "Dapper Plus", Url = "https://dapper-plus.net/", Type = "Paid" };
var product3 = new Product() { Name = "Entity Framework Extensions", Url = "https://entityframework-extensions.net/", Type = "Paid" };
var list = new List<Product>() { product1, product2, product3 };
FiddleHelper.WriteTable("1 - list:", list);
list.ReverseDynamic();
FiddleHelper.WriteTable("1 - list (reversed):", list);
}
public class Product
{
public string Name { get; set; }
public string Url { get; set; }
public string Type { get; set; }
}
}