Пример #1
0
        static void Test3()
        {
            var user = new UserX
            {
                ID           = 1234,
                Name         = "Stone",
                DisplayName  = "大石头",
                RegisterTime = DateTime.Now,
                LastLogin    = DateTime.Now,
            };

            var js = user.ToJson(true);

            Console.WriteLine(js);
            Console.WriteLine("json={0}", js.GetBytes().Length);

            var pk = user.ToPacket();

            Console.WriteLine("binary={0}", pk.Total);
            Console.WriteLine(pk.ToHex());

            var user2 = pk.ToEntity <UserX>();
            var js2   = user2.ToJson(false);

            Console.WriteLine(js2);
        }