المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Linq join



C# Programming
07-20-2011, 05:00 PM
Hi, suppose I have
var A = new[] { new {Name ="Car", N = 2}, new {Name ="Bike", N = 100} }; var B = new[] { new {Name ="Car", N = 10}, new {Name ="Plane", N = 1} };
I would like to to the following using LINQ syntax: Join A nd B getting a total collection summing also N where same objects are the same... to be clear the final output should be:

{Name ="Car", N = 12},{Name ="Bike", N = 100},{Name ="Plane", N = 1}

Thanks for your time