本文介绍了我如何为每个循环编写下面的linq查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 列表< GlobalFieldDatabase> fin = new List< GlobalFieldDatabase>(); foreach ( var t in bg){ if (UserEntites.ContainsKey(t.BudgetEntityCode)){ if (UserGlobalFields.ContainsKey(t.GlobalFieldCode)) { GlobalFieldDatabase g = new GlobalFieldDatabase(); g.BudgetEntityId = UserEntites [t.BudgetEntityCode]; g.GlobalFieldId = UserGlobalFields [t.GlobalFieldCode]; g.GlobalFieldValue = t.GlobalFieldValue; fin.Add(g); } } } 我尝试了什么: 我试过但无法完成浪费大量时间的任务TIA 解决方案 List<GlobalFieldDatabase> fin = new List<GlobalFieldDatabase>(); foreach(var t in bg){ if(UserEntites.ContainsKey(t.BudgetEntityCode)){ if (UserGlobalFields.ContainsKey(t.GlobalFieldCode)) { GlobalFieldDatabase g = new GlobalFieldDatabase(); g.BudgetEntityId = UserEntites[t.BudgetEntityCode]; g.GlobalFieldId = UserGlobalFields[t.GlobalFieldCode]; g.GlobalFieldValue = t.GlobalFieldValue; fin.Add(g); } } }What I have tried:I have tried but couldn't accomplish the task wasted lots of time TIA 解决方案 这篇关于我如何为每个循环编写下面的linq查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-26 05:56