0
所以我有它的對象與屬性集合:如何編寫一個過濾屬性方法的LINQ表達式樹?
ParentObject parentObj
{
string SomeProperty1
string SomeProperty2
}
前查詢這些屬性,他們需要向ToLower將作出()和TRIM()。我明白,我可以這樣做:
Expression.Call(pe, typeof(string).GetMethod("Trim", Type.EmptyTypes)); // Or ToLower
而且
Expression.Property(pe, typeof(string).GetProperty("SomeProperty1"));
但我怎麼結合呢?
我需要一些東西來的
from query in parentObjCollection
where query.SomeProperty1.Trim() == "asdf"
select query
任何想法相同呢?
爲什麼你需要一個表達?什麼是錯在哪裏query.SomeProperty1.Trim()==「asdf」 – Phil 2013-02-16 15:08:43
我需要基於XML輸入動態地建立這些表達式,可能會或可能不會被省略。 – jermny 2013-02-16 17:29:50