Beispiel #1
0
 public static void Serialize(TestSerializeableClass tsc)
 {
     XmlSerializer serializer = new XmlSerializer(typeof(TestSerializeableClass));
     using (TextWriter writer = new StreamWriter(@"C:\Xml.xml"))
     {
         serializer.Serialize(writer, tsc);
     }
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            TestSerializeableClass tsc = new TestSerializeableClass();
            TestNestedClass tnc = new TestNestedClass();

            tnc.AttributeInt = 2;
            tnc.AttributeString = "Nested Att";
            tsc.TestNestedClass = tnc;

            tsc.AttributeInt = 1;
            tsc.AttributeString = "Serialize";

            Serialize(tsc);
        }