Exemplo n.º 1
0
        public bool stringT()
        {
            Console.WriteLine("-- String Test");

            ClassOrg co = new ClassOrg();

            co.name = "JohnT";
            co.age  = 26;
            co.work = true;

            string sets = this.Serialize <ClassOrg>(co);

            Console.WriteLine("string size [" + sets.Length + "]");

            try {
                ClassOrg od = this.DeSerialize <ClassOrg>(sets);
                Console.WriteLine("  org name [" + od.name + "]");

                ClassCpy cd = this.DeSerialize <ClassCpy>(sets);
                Console.WriteLine("  cpy name [" + cd.name + "]");
            } catch (Exception e) {
                Console.WriteLine("Org 2 Cpy [" + e.Message + "]");
                return(false);
            }

            return(true);
        }
Exemplo n.º 2
0
        public bool binaryT()
        {
            Console.WriteLine("-- Binary Test");

            ClassOrg co = new ClassOrg();

            co.name = "JohnB";
            co.age  = 26;
            co.work = true;

            byte[] sets = this.BSerialize <ClassOrg>(co);
            Console.WriteLine("binary size [" + sets.Length + "]");

            try {
                ClassOrg od = this.BDeSerialize <ClassOrg>(sets);
                Console.WriteLine("  org name [" + od.name + "]");

                ClassCpy cd = this.BDeSerialize <ClassCpy>(sets);
                Console.WriteLine("  cpy name [" + cd.name + "]");
            } catch (Exception e) {
                Console.WriteLine("Org 2 Cpy [" + e.Message + "]");
                return(false);
            }

            return(true);
        }