【发布时间】:2013-05-19 08:16:42
【问题描述】:
我有一个过程,我在列表中标识行 (unmatchedClient),然后调用单独的方法来删除它们 (pingtree.RemoveNodes)。这似乎有点冗长,我可以通过仅将属性“DeleteFlag”的值设置为 true 来实现相同的目标。但是如何使用 linq 设置值?
var unmatchedClient = pingtree.Nodes.Where(x =>
_application.LoanAmount < x.Lender.MinLoanAmount ||
_application.LoanAmount > x.Lender.MaxLoanAmount ||
_application.LoanTerm < x.Lender.MinLoanTerm ||
_application.LoanTerm > x.Lender.MaxLoanTerm)
.Select(x => x.TreeNode)
.ToList();
pingtree.RemoveNodes(unmatchedClient);
提前致谢。
【问题讨论】:
-
在为您的问题选择解决方案之前,请考虑问题 Assigning values inside a LINQ Select? 的答案