1
我有一段代碼在LINQ查詢子句:要選擇凡使用功能
IList<Opportunity> filteredOpportunityProperties = new List<Opportunity>();
List<LookupWithIntId> selectedProperties = opportunityFilter.PropertyTypes;
List<string> propertyTypes = selectedProperties.Select(item => item.Name).ToList();
opportunities.Where((item) =>
{
string productType = item.Properties[0].ProductType;
bool propertyMatch = propertyTypes.Any(propTypes => productType.Contains(propTypes));
if (propertyMatch) select item;
});
如果條件滿足我想要的項目。但是,我收到錯誤:
Embedded statement cannot be a declaration or labeled statement
任何建議!
哇,這太瘋狂了!我不知道你可以用linq做到這一點! – 2013-02-25 00:08:44