S
shapper
Hello,
I am trying to parse some data that comes in the following format:
One DataEntry contains N Dimensions. In this case N = 2;
Dimension class contains two properties: Name and Value:
IList<Object> dims = new List<Object>();
foreach (DataEntry entry in feed.Entries) {
Int32 i = entry.Dimensions.Count; // Equals 2
foreach (Dimension dim in entry.Dimensions)
dims.Add(new { Name = dim.Name, Value = dim.Value });
}
When I loop through dimensions, e.g. "foreach (Dimension dim in
entry.Dimension)", I have the following:
1st item: ROW 1 with Dim1.Name, Dim1.Value
2nd item: ROW 1 with Dim2.Name, Dim2.Value
3st item: ROW 2 with Dim1.Name, Dim1.Value
4nd item: ROW 2 with Dim2.Name, Dim2.Value
This is why I am having troubles in parsing ...
This is because the data should be:
ROW 1: Dim1.Name + Dim1.Value AND Dim2.Name and Dim2.Value
ROW 2: Dim1.Name + Dim1.Value AND Dim2.Name and Dim2.Value
My objective would be to have N columns (2 in this case)
Column 1: Dimension 1
Column 2: Dimension 2
....
And, for example, in Dimension 1 column each row would be an anonymous
object:
{ Name = Dimension.Name, Value = Dimension.Value }
Just like matrix ...
And I need to use this as follows:
I am doing this on my class constructor.
So I would like to save this data on a property or variable on the
same class so that the methods of the class can access it.
How can I do this?
Thank You,
Miguel
I am trying to parse some data that comes in the following format:
One DataEntry contains N Dimensions. In this case N = 2;
Dimension class contains two properties: Name and Value:
IList<Object> dims = new List<Object>();
foreach (DataEntry entry in feed.Entries) {
Int32 i = entry.Dimensions.Count; // Equals 2
foreach (Dimension dim in entry.Dimensions)
dims.Add(new { Name = dim.Name, Value = dim.Value });
}
When I loop through dimensions, e.g. "foreach (Dimension dim in
entry.Dimension)", I have the following:
1st item: ROW 1 with Dim1.Name, Dim1.Value
2nd item: ROW 1 with Dim2.Name, Dim2.Value
3st item: ROW 2 with Dim1.Name, Dim1.Value
4nd item: ROW 2 with Dim2.Name, Dim2.Value
This is why I am having troubles in parsing ...
This is because the data should be:
ROW 1: Dim1.Name + Dim1.Value AND Dim2.Name and Dim2.Value
ROW 2: Dim1.Name + Dim1.Value AND Dim2.Name and Dim2.Value
My objective would be to have N columns (2 in this case)
Column 1: Dimension 1
Column 2: Dimension 2
....
And, for example, in Dimension 1 column each row would be an anonymous
object:
{ Name = Dimension.Name, Value = Dimension.Value }
Just like matrix ...
And I need to use this as follows:
I am doing this on my class constructor.
So I would like to save this data on a property or variable on the
same class so that the methods of the class can access it.
How can I do this?
Thank You,
Miguel