MongoDB.Bson.Serialization.Serializers.DictionarySerializer.CreateInstance C# (CSharp) Метод

CreateInstance() приватный Метод

private CreateInstance ( Type type ) : IDictionary
type System.Type
Результат IDictionary
        private IDictionary CreateInstance(Type type)
        {
            if (type.IsInterface)
            {
                // in the case of an interface pick a reasonable class that implements that interface
                if (type == typeof(IDictionary))
                {
                    return new Hashtable();
                }
            }
            else
            {
                if (type == typeof(Hashtable))
                {
                    return new Hashtable();
                }
                else if (type == typeof(ListDictionary))
                {
                    return new ListDictionary();
                }
                else if (type == typeof(OrderedDictionary))
                {
                    return new OrderedDictionary();
                }
                else if (type == typeof(SortedList))
                {
                    return new SortedList();
                }
                else if (typeof(IDictionary).IsAssignableFrom(type))
                {
                    return (IDictionary)Activator.CreateInstance(type);
                }
            }

            var message = string.Format("DictionarySerializer can't be used with type {0}.",
                BsonUtils.GetFriendlyTypeName(type));
            throw new BsonSerializationException(message);
        }