0

How do I deserialize List of lists or List of dictionaries? Here is C# code:

public enum Values : byte
{
    One,
    Two,
    Three,
    Four
}
public class Something
{
    public int Some_int { get; set; }
}
public class Test
{
    public List<List<Something>> ListOfSomethingLists { get; set; }
    public List<Dictionary<Values, Something>> ListOfSomethingDictionaries { get; set; }
}

And here is XML which doesn't work cuz I don't know how to deserialize it:

    <?xml version="1.0" encoding="utf-8" ?>
<XnaContent>
  <Asset Type="Test">
    <ListOfSomethingLists>
      <Item>
        <Item>
           1
        </Item>
        <Item>
           2
        </Item>
      </Item>
      <Item>
        <Item>
           3
        </Item>
        <Item>
           4
        </Item>
      </Item>
    </ListOfSomethingLists>
    <ListOfSomethingDictionaries>
      <Item>
        <Item>
          <Key>One</Key>
          <Value>1</Value>
        </Item>
        <Item>
          <Key>Two</Key>
          <Value>2</Value>
        </Item>
      </Item>
      <Item>
        <Item>
          <Key>Three</Key>
          <Value>3</Value>
        </Item>
        <Item>
          <Key>Four</Key>
          <Value>4</Value>
        </Item>
      </Item>
    </ListOfSomethingDictionaries>
  </Asset>
</XnaContent>

I actually didn't test this code but I have almost the same in my game. And still confused how to deserialize list of lists and list of dictionaries. Thanks in advance.

Wallstrider
  • 856
  • 1
  • 7
  • 22

1 Answers1

1

With this explanation you should be possible to solve your problem.

http://xboxforums.create.msdn.com/forums/p/70599/614469.aspx

little example.

    [assembly: SecurityTransparent] 
    namespace randomnamespace
    { 
        public class randomclass
        { 

        } 
    }
MCollard
  • 926
  • 2
  • 20
  • 39