我有以下xml:
<systemconfiguration>
<filelocations>
<datafile />
<samplefile />
</filelocations>
</systemconfiguration>
现在我有以下 .cs 用于此 xml 的序列化(反序列化):
[XmlType(TypeName = "systemconfiguration")]
public class SConfiguration : ISerializable
{
[XmlElement("filelocations")]
public FileLocations FilesL
{
get;
set;
}
}
[XmlType(TypeName = "filelocations")]
public class FileLocations: ISerializable
{
[XmlElement("datafile")]
public string DataFile
{
get;
set;
}
[XmlElement("samplefile")]
public string SampleFile
{
get;
set;
}
}
有没有比创建另一个只有很少字符串属性的类“FileLocations”更好的可能性?