解决方法
我昨天刚刚为此目的发布了一个图书馆.
Serialize.Linq.它将linq表达式序列化为xml,json或binary.
using System.Linq.Expressions using Serialize.Linq.Extensions; Expression<Func<Person,bool>> query = p => p.LastName == "Miller" && p.FirstName.StartsWith("M"); Console.WriteLine(query.ToJson()); Console.WriteLine(query.ToXml());