Example #1
0
        static void Main()
        {
            using (MemoryStream ms = new MemoryStream()) {
                Bar bar = new Bar(8, 3, 5, 21);
                bar.Save(ms);

                ms.Position = 0;

                bar = Bar.Load(ms);
                Console.WriteLine(bar);
            }
        }
Example #2
0
        [Test]         // bug 76931
        public void TestSerialization()
        {
            using (MemoryStream ms = new MemoryStream()) {
                Bar bar = new Bar(8, 3, 5, 21);
                bar.Save(ms);

                ms.Position = 0;

                bar = Bar.Load(ms);

                Assert.AreEqual("Bar [Foo (16),(Foo (6),Foo (10),Foo (42)]",
                                bar.ToString(), "#1");
            }
        }