Beispiel #1
0
        /// <summary>
        /// Try find a Type Resolver for declaring type
        /// </summary>
        private bool TryGetResolver(Type declaringType, out ITypeResolver typeResolver)
        {
            // get method declaring type - if is from any kind of list, read as Enumerable
            var isCollection = Reflection.IsCollection(declaringType);
            var isEnumerable = Reflection.IsEnumerable(declaringType);
            var isNullable   = Reflection.IsNullable(declaringType);

            var type =
                isCollection ? typeof(ICollection) :
                isEnumerable ? typeof(Enumerable) :
                isNullable ? typeof(Nullable) :
                declaringType;

            return(_resolver.TryGetValue(type, out typeResolver));
        }