public static void Test() { Matrix A = new Matrix(2, 2); A[0, 0] = 1.0; A[0, 1] = 2.0; A[1, 0] = 3.0; A[1, 1] = 4.0; Console.WriteLine(A.ToString()); // test serialization XmlSerializer serializer = new XmlSerializer(typeof(Matrix)); TextWriter writer = new StreamWriter("test.xml"); serializer.Serialize(writer, A); writer.Close(); XmlSerializer deserializer = new XmlSerializer(typeof(Matrix)); TextReader reader = new StreamReader("test.xml"); Matrix A2 = (Matrix)deserializer.Deserialize(reader); Console.WriteLine(A2); }