I have list of object array (List<object[]> a
) that come from different sources (files, sql, webservices) and I need a way to join them.
For example, I have this two list:
List<object[]> listA = new List<object[]>();
object[] a = new object[] { 1, "A", 1200, "2016-12-31" };
listA.Add(a);
a = new object[] { 2, "B", 5200, "2016-12-31" };
listA.Add(a);
a = new object[] { 3, "C", 3500, "2016-12-31" };
listA.Add(a);
a = new object[] { 4, "D", 100, "2016-12-31" };
listA.Add(a);
List<object[]> listB = new List<object[]>();
object[] b = new object[] { 44, 859, "2016-12-08" };
listB.Add(b);
b = new object[] { 23, 851, "2016-12-07" };
listB.Add(b);
b = new object[] { 31, 785, "2016-12-09" };
listB.Add(b);
And the result will be this one:
List<object[]> listC = new List<object[]>();
object[] c = new object[] { 1, "A", 1200+859, 44, "2016-12-08" };
listC.Add(c);
c = new object[] { 2, "B", 5200+851, 23, "2016-12-07" };
listC.Add(c);
c = new object[] { 3, "C", 3500+785, 31, "2016-12-09" };
listC.Add(c);
c = new object[] { 4, "D", 100, null, null };
listC.Add(c);
The lists are bigger than in the example and I have to configure how to merge then but if I found a way to do this in linq is the half of the way. Any ideas?