tangxu
2024-10-22 6a07c4c846ffbb1e93afdf0260e123e4c145f419
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System.Collections;
using System.Collections.Generic;
 
namespace DPumpHydr.WinFrmUI.WenSkin.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, includeLength: false),
                Value = token
            });
            token.Parent = this;
        }
 
        public IEnumerator<BsonProperty> GetEnumerator()
        {
            return _children.GetEnumerator();
        }
 
        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }
    }
}