예제 #1
0
        public void TestSerializeMeasure()
        {
            ArrayList al = new ArrayList();

            MeasureUnit mu = new MeasureUnit();

            mu.NewCurrencyMeasure("TestCurrencyMeasure", "USD");
            al.Add(mu);

            MeasureUnit mu2 = new MeasureUnit();

            mu2.NewComplexMeasure("Test2", CalculationTypeCode.Divide, new Measure("M1"), new Measure("m2"));
            al.Add(mu2);

            MeasureUnit mu3 = new MeasureUnit();

            mu3.NewSharesMeasure("Shares");
            al.Add(mu3);

            MeasureUnit mu4 = new MeasureUnit();

            mu4.NewSimpleMeasure("simple measure", new Measure("simple"));
            al.Add(mu4);

            MeasureUnit mu5 = new MeasureUnit();

            mu5.NewPureMeasure("Pure");
            al.Add(mu5);

            MemoryStream ms = new MemoryStream();

            XmlTextWriter tw = new XmlTextWriter(ms, Encoding.UTF8);

            XmlSerializer xml = new XmlSerializer(typeof(ArrayList), new Type[] { typeof(MeasureUnit) });

            xml.Serialize(tw, al);
        }