Пример #1
0
 internal static bool IsCollectionProducingExpression(Expression e)
 {
     if (TypeSystem.FindIEnumerable(e.Type) != null)
     {
         Type elementType = TypeSystem.GetElementType(e.Type);
         Type dataServiceCollectionOfT = WebUtil.GetDataServiceCollectionOfT(new Type[] { elementType });
         if (typeof(List <>).MakeGenericType(new Type[] { elementType }).IsAssignableFrom(e.Type) || ((dataServiceCollectionOfT != null) && dataServiceCollectionOfT.IsAssignableFrom(e.Type)))
         {
             return(true);
         }
     }
     return(false);
 }
Пример #2
0
        internal static bool IsCollectionProducingExpression(Expression e)
        {
            if (TypeSystem.FindIEnumerable(e.Type) != null)
            {
                Type elementType = TypeSystem.GetElementType(e.Type);
                Debug.Assert(elementType != null, "elementType == null");
                Type dscType = WebUtil.GetDataServiceCollectionOfT(elementType);
                if (typeof(List <>).MakeGenericType(elementType).IsAssignableFrom(e.Type) ||
                    (dscType != null && dscType.IsAssignableFrom(e.Type)))
                {
                    return(true);
                }
            }

            return(false);
        }