Exemplo n.º 1
0
        public static void PrivateSetter()
        {
            string json = @"{""MyString"":""Hello""}";

            ClassWithPrivateSetterAndGetter objCopy = JsonSerializer.Parse <ClassWithPrivateSetterAndGetter>(json);

            Assert.Null(objCopy.GetMyString());
        }
Exemplo n.º 2
0
        public static void PrivateGetter()
        {
            var obj = new ClassWithPrivateSetterAndGetter();

            obj.SetMyString("Hello");

            string json = JsonSerializer.ToString(obj);

            Assert.Equal(@"{}", json);
        }