Esempio n. 1
0
        static void Main(string[] args)
        {
            Console.WriteLine(@"http://www.AutoCSer.com/Serialize/Json.html
");
            Console.WriteLine(PublicInstanceField.TestCase());
            Console.WriteLine(AnonymousType.TestCase());
            Console.WriteLine(MemberMap.TestCase());
            Console.WriteLine(MemberMapValue.TestCase());
            Console.WriteLine(IgnoreMember.TestCase());
            Console.WriteLine(SerializeIgnoreMember.TestCase());
            Console.WriteLine(ParseIgnoreMember.TestCase());
            Console.WriteLine(CustomClass.TestCase());
            Console.WriteLine(CustomStruct.TestCase());
            Console.WriteLine(BaseType.TestCase());
            Console.WriteLine(NoConstructor.TestCase());
            Console.WriteLine(SerializeNode.TestCase());
            Console.WriteLine("Over");
            Console.ReadKey();
        }
Esempio n. 2
0
        internal static bool TestCase()
        {
            IgnoreMember value = new IgnoreMember {
                Value = 1, Ignore = 2
            };
            string         json     = AutoCSer.Json.Serializer.Serialize(value);
            NoIgnoreMember newValue = AutoCSer.Json.Parser.Parse <NoIgnoreMember>(json);

            if (newValue == null || newValue.Value != 1 || newValue.Ignore != 0)
            {
                return(false);
            }

            newValue = new NoIgnoreMember {
                Value = 1, Ignore = 2
            };
            json  = AutoCSer.Json.Serializer.Serialize(newValue);
            value = AutoCSer.Json.Parser.Parse <IgnoreMember>(json);
            return(value != null && value.Value == 1 && value.Ignore == 0);
        }