Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试这样做,但找不到解决方法。
我有一个动态对象列表等ObjectList : List<dynamic>
ObjectList : List<dynamic>
它充满了具有动态属性的对象LastName。
LastName
我正在尝试查找在 Name 属性中具有匹配字符串的所有元素。
var result = mylist.FindAll(e => e.LastName.StartsWith("Mc"));
但是当我这样做时,它会说“表达式不能包含 lambda 表达式”。
如果动态尝试以不同的样式使用它,则不能像 lambda 一样使用它
这样的事情应该有帮助
var result=(from c in mylist where c.LastName.StartsWith("Mc") select c).ToList();