Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在XML文件中,使用适当的属性对其进行注释,并使用XmlSerializer类在一行中进行序列化/反序列化。 var xs = new System.Xml.Serialization.XmlSerializer(typeof(List<int>_C#_.net_Persistent Storage - Fatal编程技术网

C# 在XML文件中,使用适当的属性对其进行注释,并使用XmlSerializer类在一行中进行序列化/反序列化。 var xs = new System.Xml.Serialization.XmlSerializer(typeof(List<int>

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

在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", 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