- Published on
C# - Easy Convert Array from XML Format
XML File
<?xml version="1.0" encoding="utf-8"?>
<Settings>
<Points>
<int>1</int>
<int>2</int>
</Points>
</Settings>
Mapping Class
[XmlRoot( "Settings" )]
public class Settings
{
[XmlArray("Points")]
[XmlArrayItem("int")]
public int[] Points { get ; set ; }
}
注意事項
使用特定的 Xml Attribute 時注意是否需要 using