public DictionarySerializer(DictionarySerializerConfig config)
    {
        if (config == null)
        {
            throw new ArgumentNullException(nameof(config));
        }

        _config = config;
        if (_config.DoNotFlattenTypes != null)
        {
            _doNotFlattenTypes = _config.DoNotFlattenTypes.ToHashSet(s => s);
        }
    }
 public DictionarySerializer()
 {
     _config = new DictionarySerializerConfig();
 }