日期:2014-05-20 浏览次数:21103 次
public static IQueryable<TSource> Count<TSource,TKey>(this IQueryable<TSource> source
, Expression<Func<TSource,TKey>> keySelector)
{
return source.Provider.CreateQuery<TSource>(Expression.Call(null
,((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(new Type[] { typeof(TSource)
, typeof(TKey) })
, new Expression[] { source.Expression, keySelector }));
}
public static IQueryable<TSource> Count<TSource,TKey>(this IQueryable<TSource> source
, Expression<Func<TSource,TKey>> keySelector)
{
return source.Provider.CreateQuery<TSource>(Expression.Call(null
, ((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(new Type[] { typeof(TSource)
, typeof(TKey) })
, new Expression[] { source.Expression, Expression.Quote(keySelector) }));
}