首页 新闻 会员 周边

集合循环改变集合中对象的属性不生效

0
悬赏园豆:5 [已关闭问题] 关闭于 2019-11-25 17:39
foreach (var part in configuredProduct.Parts)
{
  part.ProductConstraints = constraints.Result.Parts.First(p => p.Part == part.Name).ProductConstraints;
}
public Dictionary<string, Dictionary<string, List<ProductConstraintOutput>>> ProductConstraints { get; set; } = new Dictionary<string, Dictionary<string, List<ProductConstraintOutput>>>();

如上代码,想改变foreach迭代变量的属性:ProductConstraints

断点走到结尾大括号时,foreach迭代变量:part 的 ProductConstraints是有值的

但是configuredProduct.Parts中的 ProductConstraints 却还是Count=0

wudigg的主页 wudigg | 初学一级 | 园豆:12
提问于:2019-11-25 17:20
< >
分享
所有回答(1)
0

 configuredProduct

wudigg | 园豆:12 (初学一级) | 2019-11-25 17:39
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册