// @nuget: Z.Expressions.Eval
using System;
using Z.Expressions;
using System.Dynamic;
using System.Linq;
public class Program
{
public class AppUser
public string Name { get; set; }
public int? Age { get; set; }
}
public static void Main()
var lst = Enumerable.Range(1, 10).Select(x => new AppUser() { Name = "1", Age = x }).ToList();
//Eval.Execute("({0}).GroupBy(x => x.Name, (x0, y0) => new { value = x0, field = Name, aggregates = new { sum = y0.Sum(g => g?.Age), max = y0.Max(g => g?.Age) } }).ToList()", lst);