我在C#兩個集合灌裝收集,根據集合體B
A: {
{id:4, name:"", age:1},
{id:3, name:"", age:3},
{id:2, name:"", age:5},
}
B: {
{id:2, name:"aa"},
{id:4, name:"bb"},
{id:3, name:"cc"},
}
我要填寫集合,根據集合體B
A: {
{id:2, name:"aa",age:5},
{id:4, name:"bb",age:1},
{id:3, name:"cc",age:3},
}
我怎樣才能做到這一點? (?我應該使用LINQ)
我用:
private static void FillIsCpHidden(ref Collection A)
{
var B= CollectionB.ToDictionary(item => item.id);
foreach (var item in A)
{
item.name= B[item.id].name;
}
}
你想設置的名稱VALES上的一個的B?你的問題是有點短.. – IanNorton