How to serialize & deserialize below xml file using C#. I have created serializable class for this xml.
below some code to deserialize this xml, the list is able to get only single value.
<?xml version="1.0" encoding="utf-8" ?>
<Configuration>
<CSVFile>
<string>ff</string>
<string>gg</string>
<string>jj</string>
</CSVFile>
</Configuration>
[Serializable, XmlRoot("Configuration"), XmlType("Configuration")]
public class Configuration
{
public Configuration()
{
CSVFile = new List<string>();
}
[XmlElement("CSVFile")]
public List<string> CSVFile { get; set; }
}
public class Mytutorial
{
string configFilePath = "above xml file path"
XmlSerializer serializer = new XmlSerializer(typeof(Configuration));
FileStream xmlFile = new FileStream(configFilePath, FileMode.Open);
Configuration con = (Configuration)serializer.Deserialize(xmlFile);
}