我正在使用以下 linq 代码将值添加到字典中,现在发生的情况是重复的键条目是从字典中跳过两个条目,我需要至少一个存在于字典中。如何在以下 LINQ 代码中执行此操作。我只想要在 LINQ 中,代码如下所示:
dict = (from x in sites
let pp1 = x.Split(',')
where pp1.Length > 2
let rnc = pp1[1].Replace("work=", "")
let ems = pp1[2].Replace("Context=", "")
let pp2 = GetName(ems, "CC", "U").Split('_')
where pp2.Length > 1 && !ems.Contains("_L_")
select new
{
name_ms = ems,
Key = ems + "," + rnc,
Value = Getidname(GetName(ems, "CC", "U"),
GetCode(pp2[1])) + "," + ems.Split('_')[1]
})
.ToDictionary(x => x.Key, x => x.Value);
www说
慕容3067478
相关分类