Пример #1
0
        // public methods
        public void AddKnownSerializer(Type type, IBsonSerializer serializer)
        {
            if (!_knownSerializers.TryGetValue(type, out var set))
            {
                set = new HashSet <IBsonSerializer>();
                _knownSerializers.Add(type, set);
            }

            set.Add(serializer);

            _parent?.AddKnownSerializer(type, serializer);
        }
        // public methods
        public void AddKnownSerializer(Type type, IBsonSerializer serializer)
        {
            if (!_knownSerializers.TryGetValue(type, out var set))
            {
                set = new HashSet <IBsonSerializer>();
                _knownSerializers.Add(type, set);
            }

            set.Add(serializer);

            if (ShouldPropagateKnownSerializerToParent())
            {
                _parent.AddKnownSerializer(type, serializer);
            }
        }