示例#1
0
        public void TestSerializeException()
        {
            NetJSON.UseStringOptimization = true;
            var exception = new ExceptionInfoEx {
                Data = new Dictionary <string, string> {
                    { "Test1", "Hello" }
                },
                ExceptionType  = typeof(InvalidCastException),
                HelpLink       = "HelloWorld",
                InnerException = new ExceptionInfoEx {
                    HelpLink = "Inner"
                },
                Message = "Nothing here", Source = "Not found", StackTrace = "I am all here"
            };

            var json = NetJSON.Serialize(exception);

            var exceptionResult = NetJSON.Deserialize <ExceptionInfoEx>(json);
        }
示例#2
0
        public void TestSerializeException()
        {
            NetJSON.UseStringOptimization = true;
            var exception = new ExceptionInfoEx {
                Data = new Dictionary<string, string> { { "Test1", "Hello" } },
                ExceptionType = typeof(InvalidCastException),
                HelpLink = "HelloWorld",
                InnerException = new ExceptionInfoEx { HelpLink = "Inner" },
             Message = "Nothing here", Source = "Not found", StackTrace = "I am all here"};

            var json = NetJSON.Serialize(exception);

            var exceptionResult = NetJSON.Deserialize<ExceptionInfoEx>(json);
        }