using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Serialization.Formatters.Soap; class Program { static void Main(string[] args) { Worker w = new Worker(); Worker w2; w.age = 19; w.name = "Analcunt Huipesdapesda"; w.secks = 'M'; /*FileStream fs = new FileStream("AH.txt", FileMode.Create, FileAccess.ReadWrite); IFormatter bf = new BinaryFormatter(); bf.Serialize(fs, w); fs.Close();*/ FileStream fs = File.Create("AH.xml"); SoapFormatter sf1 = new SoapFormatter(); sf1.Serialize(fs, w); fs.Close(); /*fs = new FileStream("AH.txt", FileMode.Open, FileAccess.Read); w2 = (Worker)bf.Deserialize(fs); fs.Close(); Console.WriteLine("Age: " + w2.age + ", name: " + w2.name + ", secks " + w2.secks + ", name2: " + w2.seeN() + ", name3: " + w2.seeN2()); */ } } [Serializable()] class Worker { public int age; public string name; public char secks; string nameP = "12345"; public string seeN() { return nameP; } string closedF() { return nameP + "!11"; } public string seeN2() { return closedF(); } }