示例#1
0
        public static bool IsGenericTaskOf([CanBeNull] this IType taskType, [CanBeNull] IType otherType)
        {
            if (taskType == null || otherType == null)
            {
                return(false);
            }
            if (!taskType.IsGenericTask())
            {
                return(false);
            }

            var taskDeclaredType = taskType as IDeclaredType;

            if (taskDeclaredType == null)
            {
                return(false);
            }

            var substitution = taskDeclaredType.GetSubstitution();

            if (substitution.IsEmpty())
            {
                return(false);
            }
            var meaningType = substitution.Apply(substitution.Domain[0]);

            return(meaningType.IsEquals(otherType));
        }
示例#2
0
        public static bool IsGenericTaskOf([CanBeNull] this IType type, [CanBeNull] IType otherType)
        {
            if (type == null || otherType == null)
            {
                return(false);
            }
            if (!type.IsGenericTask())
            {
                return(false);
            }

            var meaningType = type.GetFirstGenericType();

            return(meaningType != null && meaningType.IsEquals(otherType));
        }