C# 在XML文件中,使用适当的属性对其进行注释,并使用XmlSerializer类在一行中进行序列化/反序列化。 var xs = new System.Xml.Serialization.XmlSerializer(typeof(List<int>
在XML文件中,使用适当的属性对其进行注释,并使用XmlSerializer类在一行中进行序列化/反序列化。C# 在XML文件中,使用适当的属性对其进行注释,并使用XmlSerializer类在一行中进行序列化/反序列化。 var xs = new System.Xml.Serialization.XmlSerializer(typeof(List<int>,c#,.net,persistent-storage,C#,.net,Persistent Storage,在XML文件中,使用适当的属性对其进行注释,并使用XmlSerializer类在一行中进行序列化/反序列化。 var xs = new System.Xml.Serialization.XmlSerializer(typeof(List<int>)); List<int> ints = new List<int> { 1, 2, 3 }; using (FileStream fs = new FileStream(@"C:\store.xml", FileM
var xs = new System.Xml.Serialization.XmlSerializer(typeof(List<int>));
List<int> ints = new List<int> { 1, 2, 3 };
using (FileStream fs = new FileStream(@"C:\store.xml", FileMode.OpenOrCreate))
{
xs.Serialize(fs, ints);
}
using (FileStream fs = new FileStream(@"C:\store.xml", FileMode.OpenOrCreate))
{
ints = xs.Deserialize(fs) as List<int>;
}
Settings.Default["SomeProperty"] = "Some Value";
Settings.Default.Save(); // Saves settings in application configuration file