我有一个带有一个名为Int:
的int属性的简单类public class TestObject
{
public int Int { get; set; }
}
和wherePredicate" Int> = 90"
当我尝试将它与IQueryable.Where(wherePredicate)一起使用时,会发生错误:System.Linq.Dynamic.Core.Exceptions.ParseException:'。'或'('或字符串文字预期
当我将wherePredicate更改为" It.Int> = 90" - 按预期工作。
答案 0 :(得分:1)
Int
是保留的关键字。
使用其他属性名称:
void Main()
{
var l = new List<TestObject>();
var q = l.AsQueryable();
var result = q.Where("X >= 90");
result.Dump(); // LINQPad
}
public class TestObject
{
public int X { get; set; }
}