Ejemplo n.º 1
0
        public static void Test()
        {
            Foo2 a = new Foo2();
            Foo1 b = new Foo1();

            a.foo1  = b;
            b.listI = new List <int>()
            {
                1, 2, 3, 4, 5
            };
            b.listC = new List <char>()
            {
                'a', 'b'
            };
            b.listB = new List <bool>()
            {
                false, false, true, false
            };
            b.listD = new List <double>()
            {
                1.0, 1.1, 1.11111, 1.123456789
            };
            b.listS = new List <string>()
            {
                "c#", "Cpp", "java", "lua"
            };
            List <Foo> listFoo = new List <Foo>(3);

            a.listFoo = listFoo;
            listFoo.Add(new Foo(1, 11, 111, 1111, 'a', 1.0f, 1.1, true, new DateTime(2018, 12, 12, 12, 12, 12), "a"));
            listFoo.Add(new Foo(2, 22, 222, 2222, 'b', 2.0f, 2.1, false, new DateTime(2017, 12, 12, 12, 12, 12), "b"));
            listFoo.Add(new Foo(3, 33, 333, 3333, 'c', 3.0f, 3.1, false, new DateTime(2016, 12, 12, 12, 12, 12), "c"));
            ByteBuffer bb = new ByteBuffer();

            a.WriteToBuffer(bb);
            Foo2 foo2 = new Foo2();

            foo2.ReaderFromBuffer(bb);
        }
Ejemplo n.º 2
0
 public void ReaderFromBuffer(ByteBuffer bb)
 {
     listFoo = bb.ReadListObject <Foo>();
     foo1    = bb.Read <Foo1>();
 }