Expression Trees and Nullable Types

前端 未结 1 1134
没有蜡笔的小新
没有蜡笔的小新 2020-12-30 01:31

I\'ve been playing around with Expression Trees. I have the following simple method that performs a query by dynamically creating an Expression Tree. ItemType is a nullabl

相关标签:
1条回答
  • 2020-12-30 02:02

    I think you need to convert it

    var right = Expression.Constant(ItemTypeValue , typeof(int?))
    ....
    
     var lambda = Expression.Lambda<Func<T, bool>>(
                Expression.Equal(
                    Expression.Property(param, "ItemType"),
                    right),
                param);
    
    0 讨论(0)
提交回复
热议问题