Example #1
0
        public static object Deserialize(Itemizer itemizer, object instance, Type type)
        {
            Deserializer deserializer = new Deserializer(itemizer);
            Result       result       = new Result(instance);
            FieldInfo    memberInfo   = new FieldInfo(deserializer.types.GetTypeInfo(typeof(Result)), Result.ValueField, type ?? instance?.GetType());

            MemberValue value = deserializer.DeserializeValue(itemizer.NextItem(), result, nameof(Result.value), memberInfo);

            Debug.Assert(itemizer.NextItem().Type == ItemType.End);

            value.SetValue(deserializer, result);
            return(result.value);
        }
        public static void Serialize(Itemizer itemizer, string indent, TextWriter writer)
        {
            TextSerializer serializer = new TextSerializer(itemizer, indent, writer);

            serializer.Serialize(itemizer.NextItem());
        }