I have this xml
<KitContent>
<MsiData>
<FileName>file1</FileName>
<BaseProductVersion>1.1.0.0</BaseProductVersion>
</MsiData>
<MsiData>
<FileName>file2</FileName>
<BaseProductVersion>1.1.0.0</BaseProductVersion>
</MsiData>
</KitContent>
I want to serialize it to a class
how does the class should look like?
public class KitContent
{
public List<MsiData> ???? { get; set; }
public KitContent()
{
??? = new List<MsiData>();
}
}
public class MsiData
{
public string FileName { get; set; }
public string BaseProductVersion { get; set; }
}
}
the ‘???’ i put in the class above is my problem
I’m not sure of what do you want, but ??? can be any identifier. If you want to parse this xml into C# classes, IMHO best way to do this is by using Xml.Serialization namespace.
Here is example:
If your property name is the same as Element in xml, you don’t need to put attribute on that property.