根据给定的行列表
帮助我从词典中获取项目List<string> conversionTypeNames = Conversion1List
.Select(k => k.ConversionTypeName)
.Distinct()
.ToList();
var query = new GoogleAdWordsData_Dictionaries_Query();
var ConversionsDict = query.GetConversionDictionary(ClientID);
ConversionsDict = ConversionsDict
.Where(k => k.ConversionTypeName == conversionTypeNames);
答案 0 :(得分:0)
所以我想你想做的是检查转换类型名称中是否存在k.ConversionTypeName,使用此语法
ConversionsDict = ConversionsDict.Where(k => conversionTypeNames.Contains(k.ConversionTypeName));
答案 1 :(得分:-1)
我找到了正确的解决方案!
var new_Dict = ConversionsDict.Where(p => p.ConversionTypeName != null && !Conversion1List.Exists(a => a.ConversionTypeName == p.ConversionTypeName)).Distinct().ToList();
答案 2 :(得分:-1)
在这里创建一个列表。
List<string> conversionTypeNames = Conversion1List
.Select(k => k.ConversionTypeName)
.Distinct()
.ToList();
请尝试按照代码提取列表
foreach (var s in conversionTypeNames)
{
ConversionsDict = ConversionsDict
.Where(k => k.ConversionTypeName == s);
}