TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
peter
NA
320
0
Create a new List from two collections using LINQ expression
Apr 20 2021 5:12 PM
I want to return another List from two collections as shown. The task is to combine the two on VendorID and calculate a new price. The lists are not static and can enlarge in size.
IList<Product> CartList = new List<Product>() {
new Product() { VendorID = 1, Email = "John@yahoo", Price = 130,Name ="john" },
new Product() { VendorID = 1, Email = "john@yahoo", Price = 210,Name="john" },
new Product() { VendorID = 2, Email = "Bill@yahoo", Price = 180,Name ="Bill" },
new Product() { VendorID = 3, Email = "Ram@yahoo" , Price = 200,Name="Ram" }
};
IList<Funds> Funding = new List<Funds>() {
new Funds(){ VendorID = 1, Funds=30},
new Funds(){ VendorID = 2, Funds=40}
};
Result: Vendor Email Price
1 John@yahoo 310 (ie 340-30)
2 Bill@yahoo 140 (ie 180-40)
3 Ram@yahoo 200
Reply
Answers (
6
)
C# programming:
please create a code for this function