How to make XmlSerialize/XmlDeserialize use ValueTuple names?

46 views Asked by At

Using XmlSerialize I serialized a class with a ValueType:

public (int x, int y) coord;

And got this result:

<coord>
  <Item1>1<Item1/>
  <Item2>2<Item2/>
<coord/>

I expected the serializer to use the name I provided but clearly it didn't. Modifying the xml to x and y results in a silent failure, setting (0,0) instead of (1,2).

Is there a way to get ValueTuple names to work XmlSerialize/XmlDeserialize?

0

There are 0 answers