I have two list collection of objects as in a format:
list1{
new Object1{ State= "AL" , Value = 3.123}
new Object2{ State= "CO", Value = 2.111}
}
list2{
new Object1{State="AL", Value=2.123}
new Object2{State="CO", Value=3.111}
}
I need to compare these two lists and generate another list like the following:
list3{
new Object1{State="AL", Value= (3.123 + 2.123)}
new Object2{ State="CO", Value =(2.111 + 3.111) }
}
Can somebody tell me how can i do this?
Andre’s answer will certainly work. You can generalize this to the concept of grouping and support an arbitrary number of
IEnumerablesto merge