Exemple #1
0
        private static void Main(string[] args)
        {
            s_typeModel = TypeModel.Create();
            s_typeAliasTable = new TypeAliasTable();

            // Serialize
            var writeStream = new MemoryStream();
            var obj1 = new AliceClass { Name = "Wonderland", Value = 100 };
            Console.WriteLine("Before Serialize: {0}", obj1);
            Serialize(writeStream, obj1);
            var data = writeStream.ToArray();
            Console.WriteLine("DataSize: {0}", data.Length);

            // Deserialize
            var readStream = new MemoryStream(data);
            var obj2 = Deserialize(readStream, (int)readStream.Length);
            Console.WriteLine("After Serialize: {0}", obj2);
        }
Exemple #2
0
        private static void Main(string[] args)
        {
            s_typeModel      = TypeModel.Create();
            s_typeAliasTable = new TypeAliasTable();

            // Serialize
            var writeStream = new MemoryStream();
            var obj1        = new AliceClass {
                Name = "Wonderland", Value = 100
            };

            Console.WriteLine("Before Serialize: {0}", obj1);
            Serialize(writeStream, obj1);
            var data = writeStream.ToArray();

            Console.WriteLine("DataSize: {0}", data.Length);

            // Deserialize
            var readStream = new MemoryStream(data);
            var obj2       = Deserialize(readStream, (int)readStream.Length);

            Console.WriteLine("After Serialize: {0}", obj2);
        }