using System.Collections.Generic;
using System.Linq.Dynamic.Core;
public static void Main()
List<Person> people = new List<Person>();
AddressLine1 = "123 Road St.",
AddressLine2 = "Placetown",
IQueryable<Person> peopleQueryable = people.AsQueryable();
string dynamicSelect = "new Person(Id, FirstName, Address)";
IEnumerable<Person> result = (IEnumerable<Person>)peopleQueryable.Select(dynamicSelect);
foreach(var person in result)
Console.WriteLine(string.Format("Id: {0}, FirstName: {1}, LastName: {2}", person.Id, person.FirstName ?? "null", person.LastName ?? "null"));
var address = person.Address;
Console.WriteLine(string.Format("Id:{0}, AddressLine1:{1}, AddressLine2: {2}, City: {3}, Postcode:{4}", address.Id, address.AddressLine1 ?? "null", address.AddressLine2 ?? "null", address.City ?? "null", address.Postcode ?? "null"));
public string FirstName {get;set;}
public string LastName {get;set;}
public Address Address {get;set;}
public string AddressLine1 {get;set;}
public string AddressLine2 {get;set;}
public string City {get;set;}
public string Postcode {get;set;}