BsonObject
using System.Collections;
using System.Collections.Generic;
namespace Newtonsoft.Json.Bson
{
internal class BsonObject : BsonToken, IEnumerable<BsonProperty>, IEnumerable
{
private readonly List<BsonProperty> _children = new List<BsonProperty>();
public override BsonType Type => BsonType.Object;
public void Add(string name, BsonToken token)
{
_children.Add(new BsonProperty {
Name = new BsonString(name, false),
Value = token
});
token.Parent = this;
}
public IEnumerator<BsonProperty> GetEnumerator()
{
return _children.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}