0

I have 2 setups:

1

- container:
  - ParamA
  - ParamB
  - ParamC

2

- container:
  ParamA: X
  ParamB: Y
  ParamC: Z

In scenario 1 it seems to be deserialized into a class container with ParamA, ParamB, and ParamC.

public class Container
{
    public string ParamA { get; set;}
    public string ParamB { get; set;}
    public string ParamC { get; set;}
}

But in Scenario 2 (note there's no '-' and it has a key/value set up with the key being anything) how would this be represented as an object?

Community
  • 1
  • 1
tbgox
  • 221
  • 5
  • 10

2 Answers2

0

Seems like Dictionary does the trick. Makes sense, it's a key-value pair of n amount.

tbgox
  • 221
  • 5
  • 10
0

In scenario 1, you have a sequence of one element, in which that element is a mapping with a single scalar key, whose value is itself a sequence of three scalars. A possible mapping to objects would be a List<Dictionary<string, List<string>>>.

In scenario 2, the difference is that the value of the first key is a mapping instead of a list. A possible maping would be List<Dictionary<string, Dictionary<string, string>>>. Another mapping would be List<Dictionary<string, Container>>.

Antoine Aubry
  • 12,203
  • 10
  • 45
  • 74