Discard() публичный Метод

Read and discard the next content value. If the next content type is JsonNodeType.OpenObject or JsonNodeType.OpenArray, then the reader will continue to read and discard content until the matching JsonNodeType.CloseObject or JsonNodeType.CloseArray content type is found. For all other content types, no additional reads are made.
public Discard ( string path ) : void
path string
Результат void
Пример #1
0
        private object Read(JsonReader reader, IJsonSerializeOperationInfo info)
        {
            var factory = _createObjectFactory.Value.Invoke();

            foreach (var propertyName in reader.ReadProperties())
            {
                if (!factory.SetValue(reader, propertyName, info))
                {
                    reader.Discard();
                }
            }

            return(factory.GetInstance());
        }
Пример #2
0
        private object Read(JsonReader reader, IJsonSerializeOperationInfo info, string path)
        {
            var factory = _createObjectFactory.Value.Invoke();

            foreach (var propertyName in reader.ReadProperties(path))
            {
                var propertyPath = path.AppendProperty(propertyName);

                if (!factory.SetValue(reader, propertyName, info, propertyPath))
                {
                    reader.Discard(propertyPath);
                }
            }

            return(factory.GetInstance());
        }
        private object Read(JsonReader reader, IJsonSerializeOperationInfo info, string path)
        {
            var factory = _createObjectFactory.Value.Invoke();

            foreach (var propertyName in reader.ReadProperties(path))
            {
                var propertyPath = path.AppendProperty(propertyName);

                if (!factory.SetValue(reader, propertyName, info, propertyPath))
                {
                    reader.Discard(propertyPath);
                }
            }

            return factory.GetInstance();
        }
Пример #4
0
        private object Read(JsonReader reader, IJsonSerializeOperationInfo info)
        {
            var factory = _createObjectFactory.Value.Invoke();

            foreach (var propertyName in reader.ReadProperties())
            {
                if (!factory.SetValue(reader, propertyName, info))
                {
                    reader.Discard();
                }
            }

            return factory.GetInstance();
        }