Пример #1
0
        public int GetMembers(NamedJsonBuffer[] members, int index, int count)
        {
            if (index < 0)
            {
                throw new ArgumentOutOfRangeException("index", index, null);
            }

            JsonBufferReader reader = CreateReader();

            if (!reader.MoveToContent())
            {
                throw new JsonException("Unexpected EOF.");
            }

            if (reader.TokenClass == JsonTokenClass.Null)
            {
                return(0);
            }

            reader.ReadToken(JsonTokenClass.Object);
            int readCount = 0;

            while (reader.TokenClass == JsonTokenClass.Member)
            {
                if (count-- == 0)
                {
                    return(~readCount);
                }

                if (members != null)
                {
                    members[index++] = new NamedJsonBuffer(reader.Text, reader.BufferValue());
                }
                else
                {
                    reader.Skip();
                }

                readCount++;
            }

            return(readCount);
        }
Пример #2
0
 public NamedJsonBuffer[] GetMembersArray()
 {
     NamedJsonBuffer[] members = new NamedJsonBuffer[GetMemberCount()];
     GetMembers(members);
     return(members);
 }
Пример #3
0
 public bool Equals(NamedJsonBuffer other)
 {
     return(Name == other.Name && Buffer.Equals(other.Buffer));
 }