FindGenericType() public static method

public static FindGenericType ( Type definition, Type type ) : Type
definition System.Type
type System.Type
return System.Type
Beispiel #1
0
        public IQueryable CreateQuery(System.Linq.Expressions.Expression expression)
        {
            if (expression == null)
            {
                throw new ArgumentNullException("expression");
            }
            Type elementType = QueryableUtility.FindGenericType(typeof(IQueryable <>), expression.Type);

            if (elementType == null)
            {
                throw new ArgumentException(string.Empty, "expression");
            }
            return(this.CreateQuery(elementType, expression));
        }
        public IQueryable CreateQuery(Expression expression)
        {
            // Copied logic from EnumerableQuery
            if (expression == null)
            {
                throw new ArgumentNullException("expression");
            }

            Type elementType = QueryableUtility.FindGenericType(typeof(IQueryable <>), expression.Type);

            if (elementType == null)
            {
                throw new ArgumentException(String.Empty, "expression");
            }

            return(CreateQuery(elementType, expression));
        }