I believe this is very similar to this, however, I need this based on equal indexes.
I have a list like this:
Time | Temp1 | Temp2 | Type
10:42:00 | 108 | 150 | Unkwon
10:44:00 | 107 | 160 | Test
10:46:00 | 108 | 130 | Test22
I have another like this:
ID | Type
40 | New1
80 | New2
100 | Test22
I don't have a field to compare both lists. Because of this, I would like to use the index (line number) of the list and <> Type.
So,
Line 1 and 2 should update because they present different type.
Result expected:
Time | Temp1 | Temp2 | Type
10:42:00 | 108 | 150 | New1
10:44:00 | 107 | 160 | New2
10:46:00 | 108 | 130 | Test22
What do I have:
foreach (var x in Graph._listData)
{
var itemToChange = newData2
.First(d =>
d[newData2.IndexOf(1)] == Graph._listData.IndexOf(1)).Type = x.Type;
}
I believe that the whole idea of this code is wrong but it what I got at this point.
The structure of my tables:
public struct GraphData
{
public double Temp1;
public double Temp2;
public DateTime Date;
public string Type;
}
public struct GraphDataWithID
{
public int IdHeader;
public string Type;
}
- So, how do I accomplish the comparison between two lists based on the index?