This question already has an answer here:
- Convert XML String to Object 11 answers
<StepList>
<Step>
<Name>Name1</Name>
<Desc>Desc1</Desc>
</Step>
<Step>
<Name>Name2</Name>
<Desc>Desc2</Desc>
</Step>
</StepList>
I have this XML,
How should i model the Class so i will be able to deserialize it using XmlSerializer
object?
Your classes should look like this
Here is my testcode.
If you want to read a text file you should load the file into a FileStream and deserialize this.
The comments above are correct. You're missing the decorators. If you want a generic deserializer you can use this.
Then you'd call it like this: