using System.Linq.Expressions;
public static void Main()
var foo = Expression.MemberInit(
Expression.New(typeof(Foo)),
Expression.Bind(typeof(Foo).GetProperty("Bar"), Expression.Constant("bar")),
Expression.Bind(typeof(Foo).GetProperty("Baz"), Expression.Constant(5)));
var lambda = Expression.Lambda<Func<Foo>>(foo).Compile();
public string Bar { get; set; }
public int Baz { get; set; }