Esempio n. 1
0
        public static bool IsDictionaryType(Type type)
        {
            ValidationUtils.ArgumentNotNull(type, "type");

            if (typeof(IDictionary).IsAssignableFrom(type))
            {
                return(true);
            }
            return(ReflectionUtils.ImplementsGenericDefinition(type, typeof(IDictionary <,>)));
        }
        public static bool IsDictionaryType(Type type)
        {
            ValidationUtils.ArgumentNotNull(type, nameof(type));

            if (typeof(IDictionary).IsAssignableFrom(type))
            {
                return(true);
            }
            if (ReflectionUtils.ImplementsGenericDefinition(type, typeof(IDictionary <,>)))
            {
                return(true);
            }
#if HAVE_READ_ONLY_COLLECTIONS
            if (ReflectionUtils.ImplementsGenericDefinition(type, typeof(IReadOnlyDictionary <,>)))
            {
                return(true);
            }
#endif

            return(false);
        }