mscorlib(4.0.0.0) API with additions
Queryable.cs
1 using System.Collections;
4 using System.Reflection;
5 
6 namespace System.Linq
7 {
9  [global::__DynamicallyInvokable]
10  public static class Queryable
11  {
12  private static MethodInfo GetMethodInfo<T1, T2>(Func<T1, T2> f, T1 unused1)
13  {
14  return f.Method;
15  }
16 
17  private static MethodInfo GetMethodInfo<T1, T2, T3>(Func<T1, T2, T3> f, T1 unused1, T2 unused2)
18  {
19  return f.Method;
20  }
21 
22  private static MethodInfo GetMethodInfo<T1, T2, T3, T4>(Func<T1, T2, T3, T4> f, T1 unused1, T2 unused2, T3 unused3)
23  {
24  return f.Method;
25  }
26 
27  private static MethodInfo GetMethodInfo<T1, T2, T3, T4, T5>(Func<T1, T2, T3, T4, T5> f, T1 unused1, T2 unused2, T3 unused3, T4 unused4)
28  {
29  return f.Method;
30  }
31 
32  private static MethodInfo GetMethodInfo<T1, T2, T3, T4, T5, T6>(Func<T1, T2, T3, T4, T5, T6> f, T1 unused1, T2 unused2, T3 unused3, T4 unused4, T5 unused5)
33  {
34  return f.Method;
35  }
36 
37  private static MethodInfo GetMethodInfo<T1, T2, T3, T4, T5, T6, T7>(Func<T1, T2, T3, T4, T5, T6, T7> f, T1 unused1, T2 unused2, T3 unused3, T4 unused4, T5 unused5, T6 unused6)
38  {
39  return f.Method;
40  }
41 
48  [global::__DynamicallyInvokable]
50  {
51  if (source == null)
52  {
53  throw Error.ArgumentNull("source");
54  }
55  if (source is IQueryable<TElement>)
56  {
57  return (IQueryable<TElement>)source;
58  }
59  return new EnumerableQuery<TElement>(source);
60  }
61 
69  [global::__DynamicallyInvokable]
70  public static IQueryable AsQueryable(this IEnumerable source)
71  {
72  if (source == null)
73  {
74  throw Error.ArgumentNull("source");
75  }
76  if (source is IQueryable)
77  {
78  return (IQueryable)source;
79  }
80  Type type = TypeHelper.FindGenericType(typeof(IEnumerable<>), source.GetType());
81  if (type == null)
82  {
83  throw Error.ArgumentNotIEnumerableGeneric("source");
84  }
85  return EnumerableQuery.Create(type.GetGenericArguments()[0], source);
86  }
87 
95  [global::__DynamicallyInvokable]
96  public static IQueryable<TSource> Where<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
97  {
98  if (source == null)
99  {
100  throw Error.ArgumentNull("source");
101  }
102  if (predicate == null)
103  {
104  throw Error.ArgumentNull("predicate");
105  }
106  return source.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(Where, source, predicate), new Expression[2]
107  {
108  source.Expression,
109  Expression.Quote(predicate)
110  }));
111  }
112 
120  [global::__DynamicallyInvokable]
121  public static IQueryable<TSource> Where<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, int, bool>> predicate)
122  {
123  if (source == null)
124  {
125  throw Error.ArgumentNull("source");
126  }
127  if (predicate == null)
128  {
129  throw Error.ArgumentNull("predicate");
130  }
131  return source.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(Where, source, predicate), new Expression[2]
132  {
133  source.Expression,
134  Expression.Quote(predicate)
135  }));
136  }
137 
144  [global::__DynamicallyInvokable]
145  public static IQueryable<TResult> OfType<TResult>(this IQueryable source)
146  {
147  if (source == null)
148  {
149  throw Error.ArgumentNull("source");
150  }
151  return source.Provider.CreateQuery<TResult>(Expression.Call(null, GetMethodInfo(Queryable.OfType<TResult>, source), source.Expression));
152  }
153 
161  [global::__DynamicallyInvokable]
162  public static IQueryable<TResult> Cast<TResult>(this IQueryable source)
163  {
164  if (source == null)
165  {
166  throw Error.ArgumentNull("source");
167  }
168  return source.Provider.CreateQuery<TResult>(Expression.Call(null, GetMethodInfo(Queryable.Cast<TResult>, source), source.Expression));
169  }
170 
179  [global::__DynamicallyInvokable]
180  public static IQueryable<TResult> Select<TSource, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, TResult>> selector)
181  {
182  if (source == null)
183  {
184  throw Error.ArgumentNull("source");
185  }
186  if (selector == null)
187  {
188  throw Error.ArgumentNull("selector");
189  }
190  return source.Provider.CreateQuery<TResult>(Expression.Call(null, GetMethodInfo(Select, source, selector), new Expression[2]
191  {
192  source.Expression,
193  Expression.Quote(selector)
194  }));
195  }
196 
205  [global::__DynamicallyInvokable]
206  public static IQueryable<TResult> Select<TSource, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, int, TResult>> selector)
207  {
208  if (source == null)
209  {
210  throw Error.ArgumentNull("source");
211  }
212  if (selector == null)
213  {
214  throw Error.ArgumentNull("selector");
215  }
216  return source.Provider.CreateQuery<TResult>(Expression.Call(null, GetMethodInfo(Select, source, selector), new Expression[2]
217  {
218  source.Expression,
219  Expression.Quote(selector)
220  }));
221  }
222 
231  [global::__DynamicallyInvokable]
233  {
234  if (source == null)
235  {
236  throw Error.ArgumentNull("source");
237  }
238  if (selector == null)
239  {
240  throw Error.ArgumentNull("selector");
241  }
242  return source.Provider.CreateQuery<TResult>(Expression.Call(null, GetMethodInfo(SelectMany, source, selector), new Expression[2]
243  {
244  source.Expression,
245  Expression.Quote(selector)
246  }));
247  }
248 
257  [global::__DynamicallyInvokable]
259  {
260  if (source == null)
261  {
262  throw Error.ArgumentNull("source");
263  }
264  if (selector == null)
265  {
266  throw Error.ArgumentNull("selector");
267  }
268  return source.Provider.CreateQuery<TResult>(Expression.Call(null, GetMethodInfo(SelectMany, source, selector), new Expression[2]
269  {
270  source.Expression,
271  Expression.Quote(selector)
272  }));
273  }
274 
285  [global::__DynamicallyInvokable]
286  public static IQueryable<TResult> SelectMany<TSource, TCollection, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, int, IEnumerable<TCollection>>> collectionSelector, Expression<Func<TSource, TCollection, TResult>> resultSelector)
287  {
288  if (source == null)
289  {
290  throw Error.ArgumentNull("source");
291  }
292  if (collectionSelector == null)
293  {
294  throw Error.ArgumentNull("collectionSelector");
295  }
296  if (resultSelector == null)
297  {
298  throw Error.ArgumentNull("resultSelector");
299  }
300  return source.Provider.CreateQuery<TResult>(Expression.Call(null, GetMethodInfo(SelectMany, source, collectionSelector, resultSelector), new Expression[3]
301  {
302  source.Expression,
303  Expression.Quote(collectionSelector),
304  Expression.Quote(resultSelector)
305  }));
306  }
307 
318  [global::__DynamicallyInvokable]
319  public static IQueryable<TResult> SelectMany<TSource, TCollection, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, IEnumerable<TCollection>>> collectionSelector, Expression<Func<TSource, TCollection, TResult>> resultSelector)
320  {
321  if (source == null)
322  {
323  throw Error.ArgumentNull("source");
324  }
325  if (collectionSelector == null)
326  {
327  throw Error.ArgumentNull("collectionSelector");
328  }
329  if (resultSelector == null)
330  {
331  throw Error.ArgumentNull("resultSelector");
332  }
333  return source.Provider.CreateQuery<TResult>(Expression.Call(null, GetMethodInfo(SelectMany, source, collectionSelector, resultSelector), new Expression[3]
334  {
335  source.Expression,
336  Expression.Quote(collectionSelector),
337  Expression.Quote(resultSelector)
338  }));
339  }
340 
341  private static Expression GetSourceExpression<TSource>(IEnumerable<TSource> source)
342  {
343  IQueryable<TSource> queryable = source as IQueryable<TSource>;
344  if (queryable != null)
345  {
346  return queryable.Expression;
347  }
348  return Expression.Constant(source, typeof(IEnumerable<TSource>));
349  }
350 
364  [global::__DynamicallyInvokable]
365  public static IQueryable<TResult> Join<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer, IEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, TInner, TResult>> resultSelector)
366  {
367  if (outer == null)
368  {
369  throw Error.ArgumentNull("outer");
370  }
371  if (inner == null)
372  {
373  throw Error.ArgumentNull("inner");
374  }
375  if (outerKeySelector == null)
376  {
377  throw Error.ArgumentNull("outerKeySelector");
378  }
379  if (innerKeySelector == null)
380  {
381  throw Error.ArgumentNull("innerKeySelector");
382  }
383  if (resultSelector == null)
384  {
385  throw Error.ArgumentNull("resultSelector");
386  }
387  return outer.Provider.CreateQuery<TResult>(Expression.Call(null, GetMethodInfo(Join, outer, inner, outerKeySelector, innerKeySelector, resultSelector), outer.Expression, GetSourceExpression(inner), Expression.Quote(outerKeySelector), Expression.Quote(innerKeySelector), Expression.Quote(resultSelector)));
388  }
389 
404  [global::__DynamicallyInvokable]
405  public static IQueryable<TResult> Join<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer, IEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, TInner, TResult>> resultSelector, IEqualityComparer<TKey> comparer)
406  {
407  if (outer == null)
408  {
409  throw Error.ArgumentNull("outer");
410  }
411  if (inner == null)
412  {
413  throw Error.ArgumentNull("inner");
414  }
415  if (outerKeySelector == null)
416  {
417  throw Error.ArgumentNull("outerKeySelector");
418  }
419  if (innerKeySelector == null)
420  {
421  throw Error.ArgumentNull("innerKeySelector");
422  }
423  if (resultSelector == null)
424  {
425  throw Error.ArgumentNull("resultSelector");
426  }
427  return outer.Provider.CreateQuery<TResult>(Expression.Call(null, GetMethodInfo(Join, outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer), outer.Expression, GetSourceExpression(inner), Expression.Quote(outerKeySelector), Expression.Quote(innerKeySelector), Expression.Quote(resultSelector), Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
428  }
429 
443  [global::__DynamicallyInvokable]
444  public static IQueryable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer, IEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, IEnumerable<TInner>, TResult>> resultSelector)
445  {
446  if (outer == null)
447  {
448  throw Error.ArgumentNull("outer");
449  }
450  if (inner == null)
451  {
452  throw Error.ArgumentNull("inner");
453  }
454  if (outerKeySelector == null)
455  {
456  throw Error.ArgumentNull("outerKeySelector");
457  }
458  if (innerKeySelector == null)
459  {
460  throw Error.ArgumentNull("innerKeySelector");
461  }
462  if (resultSelector == null)
463  {
464  throw Error.ArgumentNull("resultSelector");
465  }
466  return outer.Provider.CreateQuery<TResult>(Expression.Call(null, GetMethodInfo(GroupJoin, outer, inner, outerKeySelector, innerKeySelector, resultSelector), outer.Expression, GetSourceExpression(inner), Expression.Quote(outerKeySelector), Expression.Quote(innerKeySelector), Expression.Quote(resultSelector)));
467  }
468 
483  [global::__DynamicallyInvokable]
484  public static IQueryable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer, IEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, IEnumerable<TInner>, TResult>> resultSelector, IEqualityComparer<TKey> comparer)
485  {
486  if (outer == null)
487  {
488  throw Error.ArgumentNull("outer");
489  }
490  if (inner == null)
491  {
492  throw Error.ArgumentNull("inner");
493  }
494  if (outerKeySelector == null)
495  {
496  throw Error.ArgumentNull("outerKeySelector");
497  }
498  if (innerKeySelector == null)
499  {
500  throw Error.ArgumentNull("innerKeySelector");
501  }
502  if (resultSelector == null)
503  {
504  throw Error.ArgumentNull("resultSelector");
505  }
506  return outer.Provider.CreateQuery<TResult>(Expression.Call(null, GetMethodInfo(GroupJoin, outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer), outer.Expression, GetSourceExpression(inner), Expression.Quote(outerKeySelector), Expression.Quote(innerKeySelector), Expression.Quote(resultSelector), Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
507  }
508 
517  [global::__DynamicallyInvokable]
518  public static IOrderedQueryable<TSource> OrderBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
519  {
520  if (source == null)
521  {
522  throw Error.ArgumentNull("source");
523  }
524  if (keySelector == null)
525  {
526  throw Error.ArgumentNull("keySelector");
527  }
528  return (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(OrderBy, source, keySelector), new Expression[2]
529  {
530  source.Expression,
531  Expression.Quote(keySelector)
532  }));
533  }
534 
544  [global::__DynamicallyInvokable]
545  public static IOrderedQueryable<TSource> OrderBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
546  {
547  if (source == null)
548  {
549  throw Error.ArgumentNull("source");
550  }
551  if (keySelector == null)
552  {
553  throw Error.ArgumentNull("keySelector");
554  }
555  return (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(OrderBy, source, keySelector, comparer), new Expression[3]
556  {
557  source.Expression,
558  Expression.Quote(keySelector),
559  Expression.Constant(comparer, typeof(IComparer<TKey>))
560  }));
561  }
562 
571  [global::__DynamicallyInvokable]
572  public static IOrderedQueryable<TSource> OrderByDescending<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
573  {
574  if (source == null)
575  {
576  throw Error.ArgumentNull("source");
577  }
578  if (keySelector == null)
579  {
580  throw Error.ArgumentNull("keySelector");
581  }
582  return (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(OrderByDescending, source, keySelector), new Expression[2]
583  {
584  source.Expression,
585  Expression.Quote(keySelector)
586  }));
587  }
588 
598  [global::__DynamicallyInvokable]
599  public static IOrderedQueryable<TSource> OrderByDescending<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
600  {
601  if (source == null)
602  {
603  throw Error.ArgumentNull("source");
604  }
605  if (keySelector == null)
606  {
607  throw Error.ArgumentNull("keySelector");
608  }
609  return (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(OrderByDescending, source, keySelector, comparer), new Expression[3]
610  {
611  source.Expression,
612  Expression.Quote(keySelector),
613  Expression.Constant(comparer, typeof(IComparer<TKey>))
614  }));
615  }
616 
625  [global::__DynamicallyInvokable]
626  public static IOrderedQueryable<TSource> ThenBy<TSource, TKey>(this IOrderedQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
627  {
628  if (source == null)
629  {
630  throw Error.ArgumentNull("source");
631  }
632  if (keySelector == null)
633  {
634  throw Error.ArgumentNull("keySelector");
635  }
636  return (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(ThenBy, source, keySelector), new Expression[2]
637  {
638  source.Expression,
639  Expression.Quote(keySelector)
640  }));
641  }
642 
652  [global::__DynamicallyInvokable]
653  public static IOrderedQueryable<TSource> ThenBy<TSource, TKey>(this IOrderedQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
654  {
655  if (source == null)
656  {
657  throw Error.ArgumentNull("source");
658  }
659  if (keySelector == null)
660  {
661  throw Error.ArgumentNull("keySelector");
662  }
663  return (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(ThenBy, source, keySelector, comparer), new Expression[3]
664  {
665  source.Expression,
666  Expression.Quote(keySelector),
667  Expression.Constant(comparer, typeof(IComparer<TKey>))
668  }));
669  }
670 
679  [global::__DynamicallyInvokable]
680  public static IOrderedQueryable<TSource> ThenByDescending<TSource, TKey>(this IOrderedQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
681  {
682  if (source == null)
683  {
684  throw Error.ArgumentNull("source");
685  }
686  if (keySelector == null)
687  {
688  throw Error.ArgumentNull("keySelector");
689  }
690  return (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(ThenByDescending, source, keySelector), new Expression[2]
691  {
692  source.Expression,
693  Expression.Quote(keySelector)
694  }));
695  }
696 
706  [global::__DynamicallyInvokable]
707  public static IOrderedQueryable<TSource> ThenByDescending<TSource, TKey>(this IOrderedQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
708  {
709  if (source == null)
710  {
711  throw Error.ArgumentNull("source");
712  }
713  if (keySelector == null)
714  {
715  throw Error.ArgumentNull("keySelector");
716  }
717  return (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(ThenByDescending, source, keySelector, comparer), new Expression[3]
718  {
719  source.Expression,
720  Expression.Quote(keySelector),
721  Expression.Constant(comparer, typeof(IComparer<TKey>))
722  }));
723  }
724 
732  [global::__DynamicallyInvokable]
733  public static IQueryable<TSource> Take<TSource>(this IQueryable<TSource> source, int count)
734  {
735  if (source == null)
736  {
737  throw Error.ArgumentNull("source");
738  }
739  return source.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(Take, source, count), new Expression[2]
740  {
741  source.Expression,
742  Expression.Constant(count)
743  }));
744  }
745 
753  [global::__DynamicallyInvokable]
754  public static IQueryable<TSource> TakeWhile<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
755  {
756  if (source == null)
757  {
758  throw Error.ArgumentNull("source");
759  }
760  if (predicate == null)
761  {
762  throw Error.ArgumentNull("predicate");
763  }
764  return source.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(TakeWhile, source, predicate), new Expression[2]
765  {
766  source.Expression,
767  Expression.Quote(predicate)
768  }));
769  }
770 
778  [global::__DynamicallyInvokable]
779  public static IQueryable<TSource> TakeWhile<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, int, bool>> predicate)
780  {
781  if (source == null)
782  {
783  throw Error.ArgumentNull("source");
784  }
785  if (predicate == null)
786  {
787  throw Error.ArgumentNull("predicate");
788  }
789  return source.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(TakeWhile, source, predicate), new Expression[2]
790  {
791  source.Expression,
792  Expression.Quote(predicate)
793  }));
794  }
795 
803  [global::__DynamicallyInvokable]
804  public static IQueryable<TSource> Skip<TSource>(this IQueryable<TSource> source, int count)
805  {
806  if (source == null)
807  {
808  throw Error.ArgumentNull("source");
809  }
810  return source.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(Skip, source, count), new Expression[2]
811  {
812  source.Expression,
813  Expression.Constant(count)
814  }));
815  }
816 
824  [global::__DynamicallyInvokable]
825  public static IQueryable<TSource> SkipWhile<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
826  {
827  if (source == null)
828  {
829  throw Error.ArgumentNull("source");
830  }
831  if (predicate == null)
832  {
833  throw Error.ArgumentNull("predicate");
834  }
835  return source.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(SkipWhile, source, predicate), new Expression[2]
836  {
837  source.Expression,
838  Expression.Quote(predicate)
839  }));
840  }
841 
849  [global::__DynamicallyInvokable]
850  public static IQueryable<TSource> SkipWhile<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, int, bool>> predicate)
851  {
852  if (source == null)
853  {
854  throw Error.ArgumentNull("source");
855  }
856  if (predicate == null)
857  {
858  throw Error.ArgumentNull("predicate");
859  }
860  return source.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(SkipWhile, source, predicate), new Expression[2]
861  {
862  source.Expression,
863  Expression.Quote(predicate)
864  }));
865  }
866 
875  [global::__DynamicallyInvokable]
876  public static IQueryable<IGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
877  {
878  if (source == null)
879  {
880  throw Error.ArgumentNull("source");
881  }
882  if (keySelector == null)
883  {
884  throw Error.ArgumentNull("keySelector");
885  }
886  return source.Provider.CreateQuery<IGrouping<TKey, TSource>>(Expression.Call(null, GetMethodInfo(GroupBy, source, keySelector), new Expression[2]
887  {
888  source.Expression,
889  Expression.Quote(keySelector)
890  }));
891  }
892 
903  [global::__DynamicallyInvokable]
904  public static IQueryable<IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector)
905  {
906  if (source == null)
907  {
908  throw Error.ArgumentNull("source");
909  }
910  if (keySelector == null)
911  {
912  throw Error.ArgumentNull("keySelector");
913  }
914  if (elementSelector == null)
915  {
916  throw Error.ArgumentNull("elementSelector");
917  }
918  return source.Provider.CreateQuery<IGrouping<TKey, TElement>>(Expression.Call(null, GetMethodInfo(GroupBy, source, keySelector, elementSelector), new Expression[3]
919  {
920  source.Expression,
921  Expression.Quote(keySelector),
922  Expression.Quote(elementSelector)
923  }));
924  }
925 
935  [global::__DynamicallyInvokable]
936  public static IQueryable<IGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
937  {
938  if (source == null)
939  {
940  throw Error.ArgumentNull("source");
941  }
942  if (keySelector == null)
943  {
944  throw Error.ArgumentNull("keySelector");
945  }
946  return source.Provider.CreateQuery<IGrouping<TKey, TSource>>(Expression.Call(null, GetMethodInfo(GroupBy, source, keySelector, comparer), new Expression[3]
947  {
948  source.Expression,
949  Expression.Quote(keySelector),
950  Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))
951  }));
952  }
953 
965  [global::__DynamicallyInvokable]
966  public static IQueryable<IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, IEqualityComparer<TKey> comparer)
967  {
968  if (source == null)
969  {
970  throw Error.ArgumentNull("source");
971  }
972  if (keySelector == null)
973  {
974  throw Error.ArgumentNull("keySelector");
975  }
976  if (elementSelector == null)
977  {
978  throw Error.ArgumentNull("elementSelector");
979  }
980  return source.Provider.CreateQuery<IGrouping<TKey, TElement>>(Expression.Call(null, GetMethodInfo(GroupBy, source, keySelector, elementSelector, comparer), source.Expression, Expression.Quote(keySelector), Expression.Quote(elementSelector), Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
981  }
982 
995  [global::__DynamicallyInvokable]
996  public static IQueryable<TResult> GroupBy<TSource, TKey, TElement, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, Expression<Func<TKey, IEnumerable<TElement>, TResult>> resultSelector)
997  {
998  if (source == null)
999  {
1000  throw Error.ArgumentNull("source");
1001  }
1002  if (keySelector == null)
1003  {
1004  throw Error.ArgumentNull("keySelector");
1005  }
1006  if (elementSelector == null)
1007  {
1008  throw Error.ArgumentNull("elementSelector");
1009  }
1010  if (resultSelector == null)
1011  {
1012  throw Error.ArgumentNull("resultSelector");
1013  }
1014  return source.Provider.CreateQuery<TResult>(Expression.Call(null, GetMethodInfo(GroupBy, source, keySelector, elementSelector, resultSelector), source.Expression, Expression.Quote(keySelector), Expression.Quote(elementSelector), Expression.Quote(resultSelector)));
1015  }
1016 
1027  [global::__DynamicallyInvokable]
1028  public static IQueryable<TResult> GroupBy<TSource, TKey, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TKey, IEnumerable<TSource>, TResult>> resultSelector)
1029  {
1030  if (source == null)
1031  {
1032  throw Error.ArgumentNull("source");
1033  }
1034  if (keySelector == null)
1035  {
1036  throw Error.ArgumentNull("keySelector");
1037  }
1038  if (resultSelector == null)
1039  {
1040  throw Error.ArgumentNull("resultSelector");
1041  }
1042  return source.Provider.CreateQuery<TResult>(Expression.Call(null, GetMethodInfo(GroupBy, source, keySelector, resultSelector), new Expression[3]
1043  {
1044  source.Expression,
1045  Expression.Quote(keySelector),
1046  Expression.Quote(resultSelector)
1047  }));
1048  }
1049 
1061  [global::__DynamicallyInvokable]
1062  public static IQueryable<TResult> GroupBy<TSource, TKey, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TKey, IEnumerable<TSource>, TResult>> resultSelector, IEqualityComparer<TKey> comparer)
1063  {
1064  if (source == null)
1065  {
1066  throw Error.ArgumentNull("source");
1067  }
1068  if (keySelector == null)
1069  {
1070  throw Error.ArgumentNull("keySelector");
1071  }
1072  if (resultSelector == null)
1073  {
1074  throw Error.ArgumentNull("resultSelector");
1075  }
1076  return source.Provider.CreateQuery<TResult>(Expression.Call(null, GetMethodInfo(GroupBy, source, keySelector, resultSelector, comparer), source.Expression, Expression.Quote(keySelector), Expression.Quote(resultSelector), Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
1077  }
1078 
1092  [global::__DynamicallyInvokable]
1093  public static IQueryable<TResult> GroupBy<TSource, TKey, TElement, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, Expression<Func<TKey, IEnumerable<TElement>, TResult>> resultSelector, IEqualityComparer<TKey> comparer)
1094  {
1095  if (source == null)
1096  {
1097  throw Error.ArgumentNull("source");
1098  }
1099  if (keySelector == null)
1100  {
1101  throw Error.ArgumentNull("keySelector");
1102  }
1103  if (elementSelector == null)
1104  {
1105  throw Error.ArgumentNull("elementSelector");
1106  }
1107  if (resultSelector == null)
1108  {
1109  throw Error.ArgumentNull("resultSelector");
1110  }
1111  return source.Provider.CreateQuery<TResult>(Expression.Call(null, GetMethodInfo(GroupBy, source, keySelector, elementSelector, resultSelector, comparer), source.Expression, Expression.Quote(keySelector), Expression.Quote(elementSelector), Expression.Quote(resultSelector), Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
1112  }
1113 
1120  [global::__DynamicallyInvokable]
1122  {
1123  if (source == null)
1124  {
1125  throw Error.ArgumentNull("source");
1126  }
1127  return source.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(Distinct, source), source.Expression));
1128  }
1129 
1137  [global::__DynamicallyInvokable]
1139  {
1140  if (source == null)
1141  {
1142  throw Error.ArgumentNull("source");
1143  }
1144  return source.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(Distinct, source, comparer), new Expression[2]
1145  {
1146  source.Expression,
1147  Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))
1148  }));
1149  }
1150 
1158  [global::__DynamicallyInvokable]
1160  {
1161  if (source1 == null)
1162  {
1163  throw Error.ArgumentNull("source1");
1164  }
1165  if (source2 == null)
1166  {
1167  throw Error.ArgumentNull("source2");
1168  }
1169  return source1.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(Concat, source1, source2), new Expression[2]
1170  {
1171  source1.Expression,
1172  GetSourceExpression(source2)
1173  }));
1174  }
1175 
1186  [global::__DynamicallyInvokable]
1187  public static IQueryable<TResult> Zip<TFirst, TSecond, TResult>(this IQueryable<TFirst> source1, IEnumerable<TSecond> source2, Expression<Func<TFirst, TSecond, TResult>> resultSelector)
1188  {
1189  if (source1 == null)
1190  {
1191  throw Error.ArgumentNull("source1");
1192  }
1193  if (source2 == null)
1194  {
1195  throw Error.ArgumentNull("source2");
1196  }
1197  if (resultSelector == null)
1198  {
1199  throw Error.ArgumentNull("resultSelector");
1200  }
1201  return source1.Provider.CreateQuery<TResult>(Expression.Call(null, GetMethodInfo(Zip, source1, source2, resultSelector), new Expression[3]
1202  {
1203  source1.Expression,
1204  GetSourceExpression(source2),
1205  Expression.Quote(resultSelector)
1206  }));
1207  }
1208 
1216  [global::__DynamicallyInvokable]
1218  {
1219  if (source1 == null)
1220  {
1221  throw Error.ArgumentNull("source1");
1222  }
1223  if (source2 == null)
1224  {
1225  throw Error.ArgumentNull("source2");
1226  }
1227  return source1.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(Union, source1, source2), new Expression[2]
1228  {
1229  source1.Expression,
1230  GetSourceExpression(source2)
1231  }));
1232  }
1233 
1242  [global::__DynamicallyInvokable]
1244  {
1245  if (source1 == null)
1246  {
1247  throw Error.ArgumentNull("source1");
1248  }
1249  if (source2 == null)
1250  {
1251  throw Error.ArgumentNull("source2");
1252  }
1253  return source1.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(Union, source1, source2, comparer), new Expression[3]
1254  {
1255  source1.Expression,
1256  GetSourceExpression(source2),
1257  Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))
1258  }));
1259  }
1260 
1268  [global::__DynamicallyInvokable]
1270  {
1271  if (source1 == null)
1272  {
1273  throw Error.ArgumentNull("source1");
1274  }
1275  if (source2 == null)
1276  {
1277  throw Error.ArgumentNull("source2");
1278  }
1279  return source1.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(Intersect, source1, source2), new Expression[2]
1280  {
1281  source1.Expression,
1282  GetSourceExpression(source2)
1283  }));
1284  }
1285 
1294  [global::__DynamicallyInvokable]
1296  {
1297  if (source1 == null)
1298  {
1299  throw Error.ArgumentNull("source1");
1300  }
1301  if (source2 == null)
1302  {
1303  throw Error.ArgumentNull("source2");
1304  }
1305  return source1.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(Intersect, source1, source2, comparer), new Expression[3]
1306  {
1307  source1.Expression,
1308  GetSourceExpression(source2),
1309  Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))
1310  }));
1311  }
1312 
1320  [global::__DynamicallyInvokable]
1322  {
1323  if (source1 == null)
1324  {
1325  throw Error.ArgumentNull("source1");
1326  }
1327  if (source2 == null)
1328  {
1329  throw Error.ArgumentNull("source2");
1330  }
1331  return source1.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(Except, source1, source2), new Expression[2]
1332  {
1333  source1.Expression,
1334  GetSourceExpression(source2)
1335  }));
1336  }
1337 
1346  [global::__DynamicallyInvokable]
1348  {
1349  if (source1 == null)
1350  {
1351  throw Error.ArgumentNull("source1");
1352  }
1353  if (source2 == null)
1354  {
1355  throw Error.ArgumentNull("source2");
1356  }
1357  return source1.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(Except, source1, source2, comparer), new Expression[3]
1358  {
1359  source1.Expression,
1360  GetSourceExpression(source2),
1361  Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))
1362  }));
1363  }
1364 
1372  [global::__DynamicallyInvokable]
1373  public static TSource First<TSource>(this IQueryable<TSource> source)
1374  {
1375  if (source == null)
1376  {
1377  throw Error.ArgumentNull("source");
1378  }
1379  return source.Provider.Execute<TSource>(Expression.Call(null, GetMethodInfo(First, source), source.Expression));
1380  }
1381 
1390  [global::__DynamicallyInvokable]
1391  public static TSource First<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
1392  {
1393  if (source == null)
1394  {
1395  throw Error.ArgumentNull("source");
1396  }
1397  if (predicate == null)
1398  {
1399  throw Error.ArgumentNull("predicate");
1400  }
1401  return source.Provider.Execute<TSource>(Expression.Call(null, GetMethodInfo(First, source, predicate), new Expression[2]
1402  {
1403  source.Expression,
1404  Expression.Quote(predicate)
1405  }));
1406  }
1407 
1415  [global::__DynamicallyInvokable]
1416  public static TSource FirstOrDefault<TSource>(this IQueryable<TSource> source)
1417  {
1418  if (source == null)
1419  {
1420  throw Error.ArgumentNull("source");
1421  }
1422  return source.Provider.Execute<TSource>(Expression.Call(null, GetMethodInfo(FirstOrDefault, source), source.Expression));
1423  }
1424 
1433  [global::__DynamicallyInvokable]
1434  public static TSource FirstOrDefault<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
1435  {
1436  if (source == null)
1437  {
1438  throw Error.ArgumentNull("source");
1439  }
1440  if (predicate == null)
1441  {
1442  throw Error.ArgumentNull("predicate");
1443  }
1444  return source.Provider.Execute<TSource>(Expression.Call(null, GetMethodInfo(FirstOrDefault, source, predicate), new Expression[2]
1445  {
1446  source.Expression,
1447  Expression.Quote(predicate)
1448  }));
1449  }
1450 
1458  [global::__DynamicallyInvokable]
1459  public static TSource Last<TSource>(this IQueryable<TSource> source)
1460  {
1461  if (source == null)
1462  {
1463  throw Error.ArgumentNull("source");
1464  }
1465  return source.Provider.Execute<TSource>(Expression.Call(null, GetMethodInfo(Last, source), source.Expression));
1466  }
1467 
1476  [global::__DynamicallyInvokable]
1477  public static TSource Last<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
1478  {
1479  if (source == null)
1480  {
1481  throw Error.ArgumentNull("source");
1482  }
1483  if (predicate == null)
1484  {
1485  throw Error.ArgumentNull("predicate");
1486  }
1487  return source.Provider.Execute<TSource>(Expression.Call(null, GetMethodInfo(Last, source, predicate), new Expression[2]
1488  {
1489  source.Expression,
1490  Expression.Quote(predicate)
1491  }));
1492  }
1493 
1501  [global::__DynamicallyInvokable]
1502  public static TSource LastOrDefault<TSource>(this IQueryable<TSource> source)
1503  {
1504  if (source == null)
1505  {
1506  throw Error.ArgumentNull("source");
1507  }
1508  return source.Provider.Execute<TSource>(Expression.Call(null, GetMethodInfo(LastOrDefault, source), source.Expression));
1509  }
1510 
1519  [global::__DynamicallyInvokable]
1520  public static TSource LastOrDefault<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
1521  {
1522  if (source == null)
1523  {
1524  throw Error.ArgumentNull("source");
1525  }
1526  if (predicate == null)
1527  {
1528  throw Error.ArgumentNull("predicate");
1529  }
1530  return source.Provider.Execute<TSource>(Expression.Call(null, GetMethodInfo(LastOrDefault, source, predicate), new Expression[2]
1531  {
1532  source.Expression,
1533  Expression.Quote(predicate)
1534  }));
1535  }
1536 
1545  [global::__DynamicallyInvokable]
1546  public static TSource Single<TSource>(this IQueryable<TSource> source)
1547  {
1548  if (source == null)
1549  {
1550  throw Error.ArgumentNull("source");
1551  }
1552  return source.Provider.Execute<TSource>(Expression.Call(null, GetMethodInfo(Single, source), source.Expression));
1553  }
1554 
1563  [global::__DynamicallyInvokable]
1564  public static TSource Single<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
1565  {
1566  if (source == null)
1567  {
1568  throw Error.ArgumentNull("source");
1569  }
1570  if (predicate == null)
1571  {
1572  throw Error.ArgumentNull("predicate");
1573  }
1574  return source.Provider.Execute<TSource>(Expression.Call(null, GetMethodInfo(Single, source, predicate), new Expression[2]
1575  {
1576  source.Expression,
1577  Expression.Quote(predicate)
1578  }));
1579  }
1580 
1589  [global::__DynamicallyInvokable]
1590  public static TSource SingleOrDefault<TSource>(this IQueryable<TSource> source)
1591  {
1592  if (source == null)
1593  {
1594  throw Error.ArgumentNull("source");
1595  }
1596  return source.Provider.Execute<TSource>(Expression.Call(null, GetMethodInfo(SingleOrDefault, source), source.Expression));
1597  }
1598 
1607  [global::__DynamicallyInvokable]
1608  public static TSource SingleOrDefault<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
1609  {
1610  if (source == null)
1611  {
1612  throw Error.ArgumentNull("source");
1613  }
1614  if (predicate == null)
1615  {
1616  throw Error.ArgumentNull("predicate");
1617  }
1618  return source.Provider.Execute<TSource>(Expression.Call(null, GetMethodInfo(SingleOrDefault, source, predicate), new Expression[2]
1619  {
1620  source.Expression,
1621  Expression.Quote(predicate)
1622  }));
1623  }
1624 
1634  [global::__DynamicallyInvokable]
1635  public static TSource ElementAt<TSource>(this IQueryable<TSource> source, int index)
1636  {
1637  if (source == null)
1638  {
1639  throw Error.ArgumentNull("source");
1640  }
1641  if (index < 0)
1642  {
1643  throw Error.ArgumentOutOfRange("index");
1644  }
1645  return source.Provider.Execute<TSource>(Expression.Call(null, GetMethodInfo(ElementAt, source, index), new Expression[2]
1646  {
1647  source.Expression,
1648  Expression.Constant(index)
1649  }));
1650  }
1651 
1660  [global::__DynamicallyInvokable]
1661  public static TSource ElementAtOrDefault<TSource>(this IQueryable<TSource> source, int index)
1662  {
1663  if (source == null)
1664  {
1665  throw Error.ArgumentNull("source");
1666  }
1667  return source.Provider.Execute<TSource>(Expression.Call(null, GetMethodInfo(ElementAtOrDefault, source, index), new Expression[2]
1668  {
1669  source.Expression,
1670  Expression.Constant(index)
1671  }));
1672  }
1673 
1680  [global::__DynamicallyInvokable]
1682  {
1683  if (source == null)
1684  {
1685  throw Error.ArgumentNull("source");
1686  }
1687  return source.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(DefaultIfEmpty, source), source.Expression));
1688  }
1689 
1697  [global::__DynamicallyInvokable]
1698  public static IQueryable<TSource> DefaultIfEmpty<TSource>(this IQueryable<TSource> source, TSource defaultValue)
1699  {
1700  if (source == null)
1701  {
1702  throw Error.ArgumentNull("source");
1703  }
1704  return source.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(DefaultIfEmpty, source, defaultValue), new Expression[2]
1705  {
1706  source.Expression,
1707  Expression.Constant(defaultValue, typeof(TSource))
1708  }));
1709  }
1710 
1719  [global::__DynamicallyInvokable]
1720  public static bool Contains<TSource>(this IQueryable<TSource> source, TSource item)
1721  {
1722  if (source == null)
1723  {
1724  throw Error.ArgumentNull("source");
1725  }
1726  return source.Provider.Execute<bool>(Expression.Call(null, GetMethodInfo(Contains, source, item), new Expression[2]
1727  {
1728  source.Expression,
1729  Expression.Constant(item, typeof(TSource))
1730  }));
1731  }
1732 
1742  [global::__DynamicallyInvokable]
1743  public static bool Contains<TSource>(this IQueryable<TSource> source, TSource item, IEqualityComparer<TSource> comparer)
1744  {
1745  if (source == null)
1746  {
1747  throw Error.ArgumentNull("source");
1748  }
1749  return source.Provider.Execute<bool>(Expression.Call(null, GetMethodInfo(Contains, source, item, comparer), new Expression[3]
1750  {
1751  source.Expression,
1752  Expression.Constant(item, typeof(TSource)),
1753  Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))
1754  }));
1755  }
1756 
1763  [global::__DynamicallyInvokable]
1765  {
1766  if (source == null)
1767  {
1768  throw Error.ArgumentNull("source");
1769  }
1770  return source.Provider.CreateQuery<TSource>(Expression.Call(null, GetMethodInfo(Reverse, source), source.Expression));
1771  }
1772 
1781  [global::__DynamicallyInvokable]
1782  public static bool SequenceEqual<TSource>(this IQueryable<TSource> source1, IEnumerable<TSource> source2)
1783  {
1784  if (source1 == null)
1785  {
1786  throw Error.ArgumentNull("source1");
1787  }
1788  if (source2 == null)
1789  {
1790  throw Error.ArgumentNull("source2");
1791  }
1792  return source1.Provider.Execute<bool>(Expression.Call(null, GetMethodInfo(SequenceEqual, source1, source2), new Expression[2]
1793  {
1794  source1.Expression,
1795  GetSourceExpression(source2)
1796  }));
1797  }
1798 
1808  [global::__DynamicallyInvokable]
1810  {
1811  if (source1 == null)
1812  {
1813  throw Error.ArgumentNull("source1");
1814  }
1815  if (source2 == null)
1816  {
1817  throw Error.ArgumentNull("source2");
1818  }
1819  return source1.Provider.Execute<bool>(Expression.Call(null, GetMethodInfo(SequenceEqual, source1, source2, comparer), new Expression[3]
1820  {
1821  source1.Expression,
1822  GetSourceExpression(source2),
1823  Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))
1824  }));
1825  }
1826 
1834  [global::__DynamicallyInvokable]
1835  public static bool Any<TSource>(this IQueryable<TSource> source)
1836  {
1837  if (source == null)
1838  {
1839  throw Error.ArgumentNull("source");
1840  }
1841  return source.Provider.Execute<bool>(Expression.Call(null, GetMethodInfo(Any, source), source.Expression));
1842  }
1843 
1852  [global::__DynamicallyInvokable]
1853  public static bool Any<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
1854  {
1855  if (source == null)
1856  {
1857  throw Error.ArgumentNull("source");
1858  }
1859  if (predicate == null)
1860  {
1861  throw Error.ArgumentNull("predicate");
1862  }
1863  return source.Provider.Execute<bool>(Expression.Call(null, GetMethodInfo(Any, source, predicate), new Expression[2]
1864  {
1865  source.Expression,
1866  Expression.Quote(predicate)
1867  }));
1868  }
1869 
1878  [global::__DynamicallyInvokable]
1879  public static bool All<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
1880  {
1881  if (source == null)
1882  {
1883  throw Error.ArgumentNull("source");
1884  }
1885  if (predicate == null)
1886  {
1887  throw Error.ArgumentNull("predicate");
1888  }
1889  return source.Provider.Execute<bool>(Expression.Call(null, GetMethodInfo(All, source, predicate), new Expression[2]
1890  {
1891  source.Expression,
1892  Expression.Quote(predicate)
1893  }));
1894  }
1895 
1903  [global::__DynamicallyInvokable]
1904  public static int Count<TSource>(this IQueryable<TSource> source)
1905  {
1906  if (source == null)
1907  {
1908  throw Error.ArgumentNull("source");
1909  }
1910  return source.Provider.Execute<int>(Expression.Call(null, GetMethodInfo(Count, source), source.Expression));
1911  }
1912 
1921  [global::__DynamicallyInvokable]
1922  public static int Count<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
1923  {
1924  if (source == null)
1925  {
1926  throw Error.ArgumentNull("source");
1927  }
1928  if (predicate == null)
1929  {
1930  throw Error.ArgumentNull("predicate");
1931  }
1932  return source.Provider.Execute<int>(Expression.Call(null, GetMethodInfo(Count, source, predicate), new Expression[2]
1933  {
1934  source.Expression,
1935  Expression.Quote(predicate)
1936  }));
1937  }
1938 
1946  [global::__DynamicallyInvokable]
1947  public static long LongCount<TSource>(this IQueryable<TSource> source)
1948  {
1949  if (source == null)
1950  {
1951  throw Error.ArgumentNull("source");
1952  }
1953  return source.Provider.Execute<long>(Expression.Call(null, GetMethodInfo(LongCount, source), source.Expression));
1954  }
1955 
1964  [global::__DynamicallyInvokable]
1965  public static long LongCount<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
1966  {
1967  if (source == null)
1968  {
1969  throw Error.ArgumentNull("source");
1970  }
1971  if (predicate == null)
1972  {
1973  throw Error.ArgumentNull("predicate");
1974  }
1975  return source.Provider.Execute<long>(Expression.Call(null, GetMethodInfo(LongCount, source, predicate), new Expression[2]
1976  {
1977  source.Expression,
1978  Expression.Quote(predicate)
1979  }));
1980  }
1981 
1988  [global::__DynamicallyInvokable]
1989  public static TSource Min<TSource>(this IQueryable<TSource> source)
1990  {
1991  if (source == null)
1992  {
1993  throw Error.ArgumentNull("source");
1994  }
1995  return source.Provider.Execute<TSource>(Expression.Call(null, GetMethodInfo(Min, source), source.Expression));
1996  }
1997 
2006  [global::__DynamicallyInvokable]
2007  public static TResult Min<TSource, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, TResult>> selector)
2008  {
2009  if (source == null)
2010  {
2011  throw Error.ArgumentNull("source");
2012  }
2013  if (selector == null)
2014  {
2015  throw Error.ArgumentNull("selector");
2016  }
2017  return source.Provider.Execute<TResult>(Expression.Call(null, GetMethodInfo(Min, source, selector), new Expression[2]
2018  {
2019  source.Expression,
2020  Expression.Quote(selector)
2021  }));
2022  }
2023 
2030  [global::__DynamicallyInvokable]
2031  public static TSource Max<TSource>(this IQueryable<TSource> source)
2032  {
2033  if (source == null)
2034  {
2035  throw Error.ArgumentNull("source");
2036  }
2037  return source.Provider.Execute<TSource>(Expression.Call(null, GetMethodInfo(Max, source), source.Expression));
2038  }
2039 
2048  [global::__DynamicallyInvokable]
2049  public static TResult Max<TSource, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, TResult>> selector)
2050  {
2051  if (source == null)
2052  {
2053  throw Error.ArgumentNull("source");
2054  }
2055  if (selector == null)
2056  {
2057  throw Error.ArgumentNull("selector");
2058  }
2059  return source.Provider.Execute<TResult>(Expression.Call(null, GetMethodInfo(Max, source, selector), new Expression[2]
2060  {
2061  source.Expression,
2062  Expression.Quote(selector)
2063  }));
2064  }
2065 
2072  [global::__DynamicallyInvokable]
2073  public static int Sum(this IQueryable<int> source)
2074  {
2075  if (source == null)
2076  {
2077  throw Error.ArgumentNull("source");
2078  }
2079  return source.Provider.Execute<int>(Expression.Call(null, GetMethodInfo(Sum, source), source.Expression));
2080  }
2081 
2088  [global::__DynamicallyInvokable]
2089  public static int? Sum(this IQueryable<int?> source)
2090  {
2091  if (source == null)
2092  {
2093  throw Error.ArgumentNull("source");
2094  }
2095  return source.Provider.Execute<int?>(Expression.Call(null, GetMethodInfo(Sum, source), source.Expression));
2096  }
2097 
2104  [global::__DynamicallyInvokable]
2105  public static long Sum(this IQueryable<long> source)
2106  {
2107  if (source == null)
2108  {
2109  throw Error.ArgumentNull("source");
2110  }
2111  return source.Provider.Execute<long>(Expression.Call(null, GetMethodInfo(Sum, source), source.Expression));
2112  }
2113 
2120  [global::__DynamicallyInvokable]
2121  public static long? Sum(this IQueryable<long?> source)
2122  {
2123  if (source == null)
2124  {
2125  throw Error.ArgumentNull("source");
2126  }
2127  return source.Provider.Execute<long?>(Expression.Call(null, GetMethodInfo(Sum, source), source.Expression));
2128  }
2129 
2135  [global::__DynamicallyInvokable]
2136  public static float Sum(this IQueryable<float> source)
2137  {
2138  if (source == null)
2139  {
2140  throw Error.ArgumentNull("source");
2141  }
2142  return source.Provider.Execute<float>(Expression.Call(null, GetMethodInfo(Sum, source), source.Expression));
2143  }
2144 
2150  [global::__DynamicallyInvokable]
2151  public static float? Sum(this IQueryable<float?> source)
2152  {
2153  if (source == null)
2154  {
2155  throw Error.ArgumentNull("source");
2156  }
2157  return source.Provider.Execute<float?>(Expression.Call(null, GetMethodInfo(Sum, source), source.Expression));
2158  }
2159 
2165  [global::__DynamicallyInvokable]
2166  public static double Sum(this IQueryable<double> source)
2167  {
2168  if (source == null)
2169  {
2170  throw Error.ArgumentNull("source");
2171  }
2172  return source.Provider.Execute<double>(Expression.Call(null, GetMethodInfo(Sum, source), source.Expression));
2173  }
2174 
2180  [global::__DynamicallyInvokable]
2181  public static double? Sum(this IQueryable<double?> source)
2182  {
2183  if (source == null)
2184  {
2185  throw Error.ArgumentNull("source");
2186  }
2187  return source.Provider.Execute<double?>(Expression.Call(null, GetMethodInfo(Sum, source), source.Expression));
2188  }
2189 
2196  [global::__DynamicallyInvokable]
2197  public static decimal Sum(this IQueryable<decimal> source)
2198  {
2199  if (source == null)
2200  {
2201  throw Error.ArgumentNull("source");
2202  }
2203  return source.Provider.Execute<decimal>(Expression.Call(null, GetMethodInfo(Sum, source), source.Expression));
2204  }
2205 
2212  [global::__DynamicallyInvokable]
2213  public static decimal? Sum(this IQueryable<decimal?> source)
2214  {
2215  if (source == null)
2216  {
2217  throw Error.ArgumentNull("source");
2218  }
2219  return source.Provider.Execute<decimal?>(Expression.Call(null, GetMethodInfo(Sum, source), source.Expression));
2220  }
2221 
2230  [global::__DynamicallyInvokable]
2231  public static int Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, int>> selector)
2232  {
2233  if (source == null)
2234  {
2235  throw Error.ArgumentNull("source");
2236  }
2237  if (selector == null)
2238  {
2239  throw Error.ArgumentNull("selector");
2240  }
2241  return source.Provider.Execute<int>(Expression.Call(null, GetMethodInfo(Sum, source, selector), new Expression[2]
2242  {
2243  source.Expression,
2244  Expression.Quote(selector)
2245  }));
2246  }
2247 
2256  [global::__DynamicallyInvokable]
2257  public static int? Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, int?>> selector)
2258  {
2259  if (source == null)
2260  {
2261  throw Error.ArgumentNull("source");
2262  }
2263  if (selector == null)
2264  {
2265  throw Error.ArgumentNull("selector");
2266  }
2267  return source.Provider.Execute<int?>(Expression.Call(null, GetMethodInfo(Sum, source, selector), new Expression[2]
2268  {
2269  source.Expression,
2270  Expression.Quote(selector)
2271  }));
2272  }
2273 
2282  [global::__DynamicallyInvokable]
2283  public static long Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, long>> selector)
2284  {
2285  if (source == null)
2286  {
2287  throw Error.ArgumentNull("source");
2288  }
2289  if (selector == null)
2290  {
2291  throw Error.ArgumentNull("selector");
2292  }
2293  return source.Provider.Execute<long>(Expression.Call(null, GetMethodInfo(Sum, source, selector), new Expression[2]
2294  {
2295  source.Expression,
2296  Expression.Quote(selector)
2297  }));
2298  }
2299 
2308  [global::__DynamicallyInvokable]
2309  public static long? Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, long?>> selector)
2310  {
2311  if (source == null)
2312  {
2313  throw Error.ArgumentNull("source");
2314  }
2315  if (selector == null)
2316  {
2317  throw Error.ArgumentNull("selector");
2318  }
2319  return source.Provider.Execute<long?>(Expression.Call(null, GetMethodInfo(Sum, source, selector), new Expression[2]
2320  {
2321  source.Expression,
2322  Expression.Quote(selector)
2323  }));
2324  }
2325 
2333  [global::__DynamicallyInvokable]
2334  public static float Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, float>> selector)
2335  {
2336  if (source == null)
2337  {
2338  throw Error.ArgumentNull("source");
2339  }
2340  if (selector == null)
2341  {
2342  throw Error.ArgumentNull("selector");
2343  }
2344  return source.Provider.Execute<float>(Expression.Call(null, GetMethodInfo(Sum, source, selector), new Expression[2]
2345  {
2346  source.Expression,
2347  Expression.Quote(selector)
2348  }));
2349  }
2350 
2358  [global::__DynamicallyInvokable]
2359  public static float? Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, float?>> selector)
2360  {
2361  if (source == null)
2362  {
2363  throw Error.ArgumentNull("source");
2364  }
2365  if (selector == null)
2366  {
2367  throw Error.ArgumentNull("selector");
2368  }
2369  return source.Provider.Execute<float?>(Expression.Call(null, GetMethodInfo(Sum, source, selector), new Expression[2]
2370  {
2371  source.Expression,
2372  Expression.Quote(selector)
2373  }));
2374  }
2375 
2383  [global::__DynamicallyInvokable]
2384  public static double Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, double>> selector)
2385  {
2386  if (source == null)
2387  {
2388  throw Error.ArgumentNull("source");
2389  }
2390  if (selector == null)
2391  {
2392  throw Error.ArgumentNull("selector");
2393  }
2394  return source.Provider.Execute<double>(Expression.Call(null, GetMethodInfo(Sum, source, selector), new Expression[2]
2395  {
2396  source.Expression,
2397  Expression.Quote(selector)
2398  }));
2399  }
2400 
2408  [global::__DynamicallyInvokable]
2409  public static double? Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, double?>> selector)
2410  {
2411  if (source == null)
2412  {
2413  throw Error.ArgumentNull("source");
2414  }
2415  if (selector == null)
2416  {
2417  throw Error.ArgumentNull("selector");
2418  }
2419  return source.Provider.Execute<double?>(Expression.Call(null, GetMethodInfo(Sum, source, selector), new Expression[2]
2420  {
2421  source.Expression,
2422  Expression.Quote(selector)
2423  }));
2424  }
2425 
2434  [global::__DynamicallyInvokable]
2435  public static decimal Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, decimal>> selector)
2436  {
2437  if (source == null)
2438  {
2439  throw Error.ArgumentNull("source");
2440  }
2441  if (selector == null)
2442  {
2443  throw Error.ArgumentNull("selector");
2444  }
2445  return source.Provider.Execute<decimal>(Expression.Call(null, GetMethodInfo(Sum, source, selector), new Expression[2]
2446  {
2447  source.Expression,
2448  Expression.Quote(selector)
2449  }));
2450  }
2451 
2460  [global::__DynamicallyInvokable]
2461  public static decimal? Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector)
2462  {
2463  if (source == null)
2464  {
2465  throw Error.ArgumentNull("source");
2466  }
2467  if (selector == null)
2468  {
2469  throw Error.ArgumentNull("selector");
2470  }
2471  return source.Provider.Execute<decimal?>(Expression.Call(null, GetMethodInfo(Sum, source, selector), new Expression[2]
2472  {
2473  source.Expression,
2474  Expression.Quote(selector)
2475  }));
2476  }
2477 
2485  [global::__DynamicallyInvokable]
2486  public static double Average(this IQueryable<int> source)
2487  {
2488  if (source == null)
2489  {
2490  throw Error.ArgumentNull("source");
2491  }
2492  return source.Provider.Execute<double>(Expression.Call(null, GetMethodInfo(Average, source), source.Expression));
2493  }
2494 
2500  [global::__DynamicallyInvokable]
2501  public static double? Average(this IQueryable<int?> source)
2502  {
2503  if (source == null)
2504  {
2505  throw Error.ArgumentNull("source");
2506  }
2507  return source.Provider.Execute<double?>(Expression.Call(null, GetMethodInfo(Average, source), source.Expression));
2508  }
2509 
2517  [global::__DynamicallyInvokable]
2518  public static double Average(this IQueryable<long> source)
2519  {
2520  if (source == null)
2521  {
2522  throw Error.ArgumentNull("source");
2523  }
2524  return source.Provider.Execute<double>(Expression.Call(null, GetMethodInfo(Average, source), source.Expression));
2525  }
2526 
2532  [global::__DynamicallyInvokable]
2533  public static double? Average(this IQueryable<long?> source)
2534  {
2535  if (source == null)
2536  {
2537  throw Error.ArgumentNull("source");
2538  }
2539  return source.Provider.Execute<double?>(Expression.Call(null, GetMethodInfo(Average, source), source.Expression));
2540  }
2541 
2549  [global::__DynamicallyInvokable]
2550  public static float Average(this IQueryable<float> source)
2551  {
2552  if (source == null)
2553  {
2554  throw Error.ArgumentNull("source");
2555  }
2556  return source.Provider.Execute<float>(Expression.Call(null, GetMethodInfo(Average, source), source.Expression));
2557  }
2558 
2564  [global::__DynamicallyInvokable]
2565  public static float? Average(this IQueryable<float?> source)
2566  {
2567  if (source == null)
2568  {
2569  throw Error.ArgumentNull("source");
2570  }
2571  return source.Provider.Execute<float?>(Expression.Call(null, GetMethodInfo(Average, source), source.Expression));
2572  }
2573 
2581  [global::__DynamicallyInvokable]
2582  public static double Average(this IQueryable<double> source)
2583  {
2584  if (source == null)
2585  {
2586  throw Error.ArgumentNull("source");
2587  }
2588  return source.Provider.Execute<double>(Expression.Call(null, GetMethodInfo(Average, source), source.Expression));
2589  }
2590 
2596  [global::__DynamicallyInvokable]
2597  public static double? Average(this IQueryable<double?> source)
2598  {
2599  if (source == null)
2600  {
2601  throw Error.ArgumentNull("source");
2602  }
2603  return source.Provider.Execute<double?>(Expression.Call(null, GetMethodInfo(Average, source), source.Expression));
2604  }
2605 
2613  [global::__DynamicallyInvokable]
2614  public static decimal Average(this IQueryable<decimal> source)
2615  {
2616  if (source == null)
2617  {
2618  throw Error.ArgumentNull("source");
2619  }
2620  return source.Provider.Execute<decimal>(Expression.Call(null, GetMethodInfo(Average, source), source.Expression));
2621  }
2622 
2628  [global::__DynamicallyInvokable]
2629  public static decimal? Average(this IQueryable<decimal?> source)
2630  {
2631  if (source == null)
2632  {
2633  throw Error.ArgumentNull("source");
2634  }
2635  return source.Provider.Execute<decimal?>(Expression.Call(null, GetMethodInfo(Average, source), source.Expression));
2636  }
2637 
2647  [global::__DynamicallyInvokable]
2648  public static double Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, int>> selector)
2649  {
2650  if (source == null)
2651  {
2652  throw Error.ArgumentNull("source");
2653  }
2654  if (selector == null)
2655  {
2656  throw Error.ArgumentNull("selector");
2657  }
2658  return source.Provider.Execute<double>(Expression.Call(null, GetMethodInfo(Average, source, selector), new Expression[2]
2659  {
2660  source.Expression,
2661  Expression.Quote(selector)
2662  }));
2663  }
2664 
2672  [global::__DynamicallyInvokable]
2673  public static double? Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, int?>> selector)
2674  {
2675  if (source == null)
2676  {
2677  throw Error.ArgumentNull("source");
2678  }
2679  if (selector == null)
2680  {
2681  throw Error.ArgumentNull("selector");
2682  }
2683  return source.Provider.Execute<double?>(Expression.Call(null, GetMethodInfo(Average, source, selector), new Expression[2]
2684  {
2685  source.Expression,
2686  Expression.Quote(selector)
2687  }));
2688  }
2689 
2699  [global::__DynamicallyInvokable]
2700  public static float Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, float>> selector)
2701  {
2702  if (source == null)
2703  {
2704  throw Error.ArgumentNull("source");
2705  }
2706  if (selector == null)
2707  {
2708  throw Error.ArgumentNull("selector");
2709  }
2710  return source.Provider.Execute<float>(Expression.Call(null, GetMethodInfo(Average, source, selector), new Expression[2]
2711  {
2712  source.Expression,
2713  Expression.Quote(selector)
2714  }));
2715  }
2716 
2724  [global::__DynamicallyInvokable]
2725  public static float? Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, float?>> selector)
2726  {
2727  if (source == null)
2728  {
2729  throw Error.ArgumentNull("source");
2730  }
2731  if (selector == null)
2732  {
2733  throw Error.ArgumentNull("selector");
2734  }
2735  return source.Provider.Execute<float?>(Expression.Call(null, GetMethodInfo(Average, source, selector), new Expression[2]
2736  {
2737  source.Expression,
2738  Expression.Quote(selector)
2739  }));
2740  }
2741 
2751  [global::__DynamicallyInvokable]
2752  public static double Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, long>> selector)
2753  {
2754  if (source == null)
2755  {
2756  throw Error.ArgumentNull("source");
2757  }
2758  if (selector == null)
2759  {
2760  throw Error.ArgumentNull("selector");
2761  }
2762  return source.Provider.Execute<double>(Expression.Call(null, GetMethodInfo(Average, source, selector), new Expression[2]
2763  {
2764  source.Expression,
2765  Expression.Quote(selector)
2766  }));
2767  }
2768 
2776  [global::__DynamicallyInvokable]
2777  public static double? Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, long?>> selector)
2778  {
2779  if (source == null)
2780  {
2781  throw Error.ArgumentNull("source");
2782  }
2783  if (selector == null)
2784  {
2785  throw Error.ArgumentNull("selector");
2786  }
2787  return source.Provider.Execute<double?>(Expression.Call(null, GetMethodInfo(Average, source, selector), new Expression[2]
2788  {
2789  source.Expression,
2790  Expression.Quote(selector)
2791  }));
2792  }
2793 
2803  [global::__DynamicallyInvokable]
2804  public static double Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, double>> selector)
2805  {
2806  if (source == null)
2807  {
2808  throw Error.ArgumentNull("source");
2809  }
2810  if (selector == null)
2811  {
2812  throw Error.ArgumentNull("selector");
2813  }
2814  return source.Provider.Execute<double>(Expression.Call(null, GetMethodInfo(Average, source, selector), new Expression[2]
2815  {
2816  source.Expression,
2817  Expression.Quote(selector)
2818  }));
2819  }
2820 
2828  [global::__DynamicallyInvokable]
2829  public static double? Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, double?>> selector)
2830  {
2831  if (source == null)
2832  {
2833  throw Error.ArgumentNull("source");
2834  }
2835  if (selector == null)
2836  {
2837  throw Error.ArgumentNull("selector");
2838  }
2839  return source.Provider.Execute<double?>(Expression.Call(null, GetMethodInfo(Average, source, selector), new Expression[2]
2840  {
2841  source.Expression,
2842  Expression.Quote(selector)
2843  }));
2844  }
2845 
2855  [global::__DynamicallyInvokable]
2856  public static decimal Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, decimal>> selector)
2857  {
2858  if (source == null)
2859  {
2860  throw Error.ArgumentNull("source");
2861  }
2862  if (selector == null)
2863  {
2864  throw Error.ArgumentNull("selector");
2865  }
2866  return source.Provider.Execute<decimal>(Expression.Call(null, GetMethodInfo(Average, source, selector), new Expression[2]
2867  {
2868  source.Expression,
2869  Expression.Quote(selector)
2870  }));
2871  }
2872 
2880  [global::__DynamicallyInvokable]
2881  public static decimal? Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector)
2882  {
2883  if (source == null)
2884  {
2885  throw Error.ArgumentNull("source");
2886  }
2887  if (selector == null)
2888  {
2889  throw Error.ArgumentNull("selector");
2890  }
2891  return source.Provider.Execute<decimal?>(Expression.Call(null, GetMethodInfo(Average, source, selector), new Expression[2]
2892  {
2893  source.Expression,
2894  Expression.Quote(selector)
2895  }));
2896  }
2897 
2907  [global::__DynamicallyInvokable]
2908  public static TSource Aggregate<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, TSource, TSource>> func)
2909  {
2910  if (source == null)
2911  {
2912  throw Error.ArgumentNull("source");
2913  }
2914  if (func == null)
2915  {
2916  throw Error.ArgumentNull("func");
2917  }
2918  return source.Provider.Execute<TSource>(Expression.Call(null, GetMethodInfo(Aggregate, source, func), new Expression[2]
2919  {
2920  source.Expression,
2921  Expression.Quote(func)
2922  }));
2923  }
2924 
2934  [global::__DynamicallyInvokable]
2935  public static TAccumulate Aggregate<TSource, TAccumulate>(this IQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> func)
2936  {
2937  if (source == null)
2938  {
2939  throw Error.ArgumentNull("source");
2940  }
2941  if (func == null)
2942  {
2943  throw Error.ArgumentNull("func");
2944  }
2945  return source.Provider.Execute<TAccumulate>(Expression.Call(null, GetMethodInfo(Aggregate, source, seed, func), new Expression[3]
2946  {
2947  source.Expression,
2948  Expression.Constant(seed),
2949  Expression.Quote(func)
2950  }));
2951  }
2952 
2964  [global::__DynamicallyInvokable]
2965  public static TResult Aggregate<TSource, TAccumulate, TResult>(this IQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> func, Expression<Func<TAccumulate, TResult>> selector)
2966  {
2967  if (source == null)
2968  {
2969  throw Error.ArgumentNull("source");
2970  }
2971  if (func == null)
2972  {
2973  throw Error.ArgumentNull("func");
2974  }
2975  if (selector == null)
2976  {
2977  throw Error.ArgumentNull("selector");
2978  }
2979  return source.Provider.Execute<TResult>(Expression.Call(null, GetMethodInfo(Aggregate, source, seed, func, selector), source.Expression, Expression.Constant(seed), Expression.Quote(func), Expression.Quote(selector)));
2980  }
2981  }
2982 }
static TSource Last< TSource >(this IQueryable< TSource > source)
Returns the last element in a sequence.
Definition: Queryable.cs:1459
static IOrderedQueryable< TSource > OrderByDescending< TSource, TKey >(this IQueryable< TSource > source, Expression< Func< TSource, TKey >> keySelector)
Sorts the elements of a sequence in descending order according to a key.
Definition: Queryable.cs:572
static double Average< TSource >(this IQueryable< TSource > source, Expression< Func< TSource, int >> selector)
Computes the average of a sequence of T:System.Int32 values that is obtained by invoking a projection...
Definition: Queryable.cs:2648
static bool All< TSource >(this IQueryable< TSource > source, Expression< Func< TSource, bool >> predicate)
Determines whether all the elements of a sequence satisfy a condition.
Definition: Queryable.cs:1879
static ? float Average(this IQueryable< float?> source)
Computes the average of a sequence of nullable T:System.Single values.
Definition: Queryable.cs:2565
static TAccumulate Aggregate< TSource, TAccumulate >(this IQueryable< TSource > source, TAccumulate seed, Expression< Func< TAccumulate, TSource, TAccumulate >> func)
Applies an accumulator function over a sequence. The specified seed value is used as the initial accu...
Definition: Queryable.cs:2935
static TResult Min< TSource, TResult >(this IQueryable< TSource > source, Expression< Func< TSource, TResult >> selector)
Invokes a projection function on each element of a generic T:System.Linq.IQueryable`1 and returns the...
Definition: Queryable.cs:2007
static float Average(this IQueryable< float > source)
Computes the average of a sequence of T:System.Single values.
Definition: Queryable.cs:2550
static decimal Average(this IQueryable< decimal > source)
Computes the average of a sequence of T:System.Decimal values.
Definition: Queryable.cs:2614
Discovers the attributes of a method and provides access to method metadata.
Definition: MethodInfo.cs:13
static TSource ElementAt< TSource >(this IQueryable< TSource > source, int index)
Returns the element at a specified index in a sequence.
Definition: Queryable.cs:1635
static IQueryable< TSource > Reverse< TSource >(this IQueryable< TSource > source)
Inverts the order of the elements in a sequence.
Definition: Queryable.cs:1764
static IQueryable< TSource > SkipWhile< TSource >(this IQueryable< TSource > source, Expression< Func< TSource, bool >> predicate)
Bypasses elements in a sequence as long as a specified condition is true and then returns the remaini...
Definition: Queryable.cs:825
static TSource LastOrDefault< TSource >(this IQueryable< TSource > source)
Returns the last element in a sequence, or a default value if the sequence contains no elements.
Definition: Queryable.cs:1502
Represents the result of a sorting operation.
Definition: __Canon.cs:3
static IQueryable< TResult > Join< TOuter, TInner, TKey, TResult >(this IQueryable< TOuter > outer, IEnumerable< TInner > inner, Expression< Func< TOuter, TKey >> outerKeySelector, Expression< Func< TInner, TKey >> innerKeySelector, Expression< Func< TOuter, TInner, TResult >> resultSelector)
Correlates the elements of two sequences based on matching keys. The default equality comparer is use...
Definition: Queryable.cs:365
static ? double Average(this IQueryable< double?> source)
Computes the average of a sequence of nullable T:System.Double values.
Definition: Queryable.cs:2597
static IQueryable< TSource > Where< TSource >(this IQueryable< TSource > source, Expression< Func< TSource, bool >> predicate)
Filters a sequence of values based on a predicate.
Definition: Queryable.cs:96
static IQueryable< TSource > Concat< TSource >(this IQueryable< TSource > source1, IEnumerable< TSource > source2)
Concatenates two sequences.
Definition: Queryable.cs:1159
static IQueryable< TSource > Union< TSource >(this IQueryable< TSource > source1, IEnumerable< TSource > source2)
Produces the set union of two sequences by using the default equality comparer.
Definition: Queryable.cs:1217
static TResult Aggregate< TSource, TAccumulate, TResult >(this IQueryable< TSource > source, TAccumulate seed, Expression< Func< TAccumulate, TSource, TAccumulate >> func, Expression< Func< TAccumulate, TResult >> selector)
Applies an accumulator function over a sequence. The specified seed value is used as the initial accu...
Definition: Queryable.cs:2965
static IQueryable< TResult > Select< TSource, TResult >(this IQueryable< TSource > source, Expression< Func< TSource, TResult >> selector)
Projects each element of a sequence into a new form.
Definition: Queryable.cs:180
static bool SequenceEqual< TSource >(this IQueryable< TSource > source1, IEnumerable< TSource > source2)
Determines whether two sequences are equal by using the default equality comparer to compare elements...
Definition: Queryable.cs:1782
Represents a collection of objects that have a common key.
Definition: IGrouping.cs:10
Represents an T:System.Collections.IEnumerable as an T:System.Linq.EnumerableQuery data source.
static IQueryable< TResult > Zip< TFirst, TSecond, TResult >(this IQueryable< TFirst > source1, IEnumerable< TSecond > source2, Expression< Func< TFirst, TSecond, TResult >> resultSelector)
Merges two sequences by using the specified predicate function.
Definition: Queryable.cs:1187
static ? double Sum(this IQueryable< double?> source)
Computes the sum of a sequence of nullable T:System.Double values.
Definition: Queryable.cs:2181
static ? double Average(this IQueryable< long?> source)
Computes the average of a sequence of nullable T:System.Int64 values.
Definition: Queryable.cs:2533
static TSource Max< TSource >(this IQueryable< TSource > source)
Returns the maximum value in a generic T:System.Linq.IQueryable`1.
Definition: Queryable.cs:2031
static IQueryable< TResult > GroupJoin< TOuter, TInner, TKey, TResult >(this IQueryable< TOuter > outer, IEnumerable< TInner > inner, Expression< Func< TOuter, TKey >> outerKeySelector, Expression< Func< TInner, TKey >> innerKeySelector, Expression< Func< TOuter, IEnumerable< TInner >, TResult >> resultSelector)
Correlates the elements of two sequences based on key equality and groups the results....
Definition: Queryable.cs:444
static long LongCount< TSource >(this IQueryable< TSource > source)
Returns an T:System.Int64 that represents the total number of elements in a sequence.
Definition: Queryable.cs:1947
static decimal Sum(this IQueryable< decimal > source)
Computes the sum of a sequence of T:System.Decimal values.
Definition: Queryable.cs:2197
virtual Type [] GetGenericArguments()
Returns an array of T:System.Type objects that represent the type arguments of a closed generic type ...
Definition: Type.cs:2433
Provides the base class from which the classes that represent expression tree nodes are derived....
Definition: Expression.cs:17
static IQueryable< TResult > Cast< TResult >(this IQueryable source)
Converts the elements of an T:System.Linq.IQueryable to the specified type.
Definition: Queryable.cs:162
static IQueryable< TSource > Take< TSource >(this IQueryable< TSource > source, int count)
Returns a specified number of contiguous elements from the start of a sequence.
Definition: Queryable.cs:733
Attribute can be applied to any application element.
static IQueryable AsQueryable(this IEnumerable source)
Converts an T:System.Collections.IEnumerable to an T:System.Linq.IQueryable.
Definition: Queryable.cs:70
static IQueryable< TResult > SelectMany< TSource, TCollection, TResult >(this IQueryable< TSource > source, Expression< Func< TSource, int, IEnumerable< TCollection >>> collectionSelector, Expression< Func< TSource, TCollection, TResult >> resultSelector)
Projects each element of a sequence to an T:System.Collections.Generic.IEnumerable`1 that incorporate...
Definition: Queryable.cs:286
static TSource FirstOrDefault< TSource >(this IQueryable< TSource > source)
Returns the first element of a sequence, or a default value if the sequence contains no elements.
Definition: Queryable.cs:1416
static float Sum(this IQueryable< float > source)
Computes the sum of a sequence of T:System.Single values.
Definition: Queryable.cs:2136
static bool Any< TSource >(this IQueryable< TSource > source)
Determines whether a sequence contains any elements.
Definition: Queryable.cs:1835
static double Average(this IQueryable< double > source)
Computes the average of a sequence of T:System.Double values.
Definition: Queryable.cs:2582
static TSource Aggregate< TSource >(this IQueryable< TSource > source, Expression< Func< TSource, TSource, TSource >> func)
Applies an accumulator function over a sequence.
Definition: Queryable.cs:2908
static IQueryable< IGrouping< TKey, TElement > > GroupBy< TSource, TKey, TElement >(this IQueryable< TSource > source, Expression< Func< TSource, TKey >> keySelector, Expression< Func< TSource, TElement >> elementSelector)
Groups the elements of a sequence according to a specified key selector function and projects the ele...
Definition: Queryable.cs:904
static TResult Max< TSource, TResult >(this IQueryable< TSource > source, Expression< Func< TSource, TResult >> selector)
Invokes a projection function on each element of a generic T:System.Linq.IQueryable`1 and returns the...
Definition: Queryable.cs:2049
static IQueryable< TElement > AsQueryable< TElement >(this IEnumerable< TElement > source)
Converts a generic T:System.Collections.Generic.IEnumerable`1 to a generic T:System....
Definition: Queryable.cs:49
static IOrderedQueryable< TSource > OrderBy< TSource, TKey >(this IQueryable< TSource > source, Expression< Func< TSource, TKey >> keySelector)
Sorts the elements of a sequence in ascending order according to a key.
Definition: Queryable.cs:518
static IQueryable< TSource > DefaultIfEmpty< TSource >(this IQueryable< TSource > source)
Returns the elements of the specified sequence or the type parameter's default value in a singleton c...
Definition: Queryable.cs:1681
static double Sum(this IQueryable< double > source)
Computes the sum of a sequence of T:System.Double values.
Definition: Queryable.cs:2166
static ? long Sum(this IQueryable< long?> source)
Computes the sum of a sequence of nullable T:System.Int64 values.
Definition: Queryable.cs:2121
Represents type declarations: class types, interface types, array types, value types,...
Definition: Type.cs:18
static TSource Min< TSource >(this IQueryable< TSource > source)
Returns the minimum value of a generic T:System.Linq.IQueryable`1.
Definition: Queryable.cs:1989
Provides functionality to evaluate queries against a specific data source wherein the type of the dat...
Definition: IQueryable.cs:9
static TSource ElementAtOrDefault< TSource >(this IQueryable< TSource > source, int index)
Returns the element at a specified index in a sequence or a default value if the index is out of rang...
Definition: Queryable.cs:1661
static ? float Sum(this IQueryable< float?> source)
Computes the sum of a sequence of nullable T:System.Single values.
Definition: Queryable.cs:2151
static ? int Sum(this IQueryable< int?> source)
Computes the sum of a sequence of nullable T:System.Int32 values.
Definition: Queryable.cs:2089
static IQueryable< TResult > GroupBy< TSource, TKey, TElement, TResult >(this IQueryable< TSource > source, Expression< Func< TSource, TKey >> keySelector, Expression< Func< TSource, TElement >> elementSelector, Expression< Func< TKey, IEnumerable< TElement >, TResult >> resultSelector)
Groups the elements of a sequence according to a specified key selector function and creates a result...
Definition: Queryable.cs:996
static IQueryable< TSource > Skip< TSource >(this IQueryable< TSource > source, int count)
Bypasses a specified number of elements in a sequence and then returns the remaining elements.
Definition: Queryable.cs:804
static ? decimal Average(this IQueryable< decimal?> source)
Computes the average of a sequence of nullable T:System.Decimal values.
Definition: Queryable.cs:2629
static IOrderedQueryable< TSource > ThenByDescending< TSource, TKey >(this IOrderedQueryable< TSource > source, Expression< Func< TSource, TKey >> keySelector)
Performs a subsequent ordering of the elements in a sequence in descending order, according to a key.
Definition: Queryable.cs:680
Represents a single-precision floating-point number.
Definition: Single.cs:13
static IQueryable< TSource > TakeWhile< TSource >(this IQueryable< TSource > source, Expression< Func< TSource, bool >> predicate)
Returns elements from a sequence as long as a specified condition is true.
Definition: Queryable.cs:754
static IQueryable< TResult > SelectMany< TSource, TResult >(this IQueryable< TSource > source, Expression< Func< TSource, IEnumerable< TResult >>> selector)
Projects each element of a sequence to an T:System.Collections.Generic.IEnumerable`1 and combines the...
Definition: Queryable.cs:232
static double Average(this IQueryable< int > source)
Computes the average of a sequence of T:System.Int32 values.
Definition: Queryable.cs:2486
static IQueryable< TSource > Intersect< TSource >(this IQueryable< TSource > source1, IEnumerable< TSource > source2)
Produces the set intersection of two sequences by using the default equality comparer to compare valu...
Definition: Queryable.cs:1269
static IQueryable< TSource > Distinct< TSource >(this IQueryable< TSource > source)
Returns distinct elements from a sequence by using the default equality comparer to compare values.
Definition: Queryable.cs:1121
static IQueryable< TResult > GroupBy< TSource, TKey, TResult >(this IQueryable< TSource > source, Expression< Func< TSource, TKey >> keySelector, Expression< Func< TKey, IEnumerable< TSource >, TResult >> resultSelector)
Groups the elements of a sequence according to a specified key selector function and creates a result...
Definition: Queryable.cs:1028
static long Sum(this IQueryable< long > source)
Computes the sum of a sequence of T:System.Int64 values.
Definition: Queryable.cs:2105
static TSource SingleOrDefault< TSource >(this IQueryable< TSource > source)
Returns the only element of a sequence, or a default value if the sequence is empty; this method thro...
Definition: Queryable.cs:1590
static bool Contains< TSource >(this IQueryable< TSource > source, TSource item)
Determines whether a sequence contains a specified element by using the default equality comparer.
Definition: Queryable.cs:1720
static int Sum(this IQueryable< int > source)
Computes the sum of a sequence of T:System.Int32 values.
Definition: Queryable.cs:2073
static double Average(this IQueryable< long > source)
Computes the average of a sequence of T:System.Int64 values.
Definition: Queryable.cs:2518
static int Count< TSource >(this IQueryable< TSource > source)
Returns the number of elements in a sequence.
Definition: Queryable.cs:1904
static ? decimal Sum(this IQueryable< decimal?> source)
Computes the sum of a sequence of nullable T:System.Decimal values.
Definition: Queryable.cs:2213
static IQueryable< IGrouping< TKey, TSource > > GroupBy< TSource, TKey >(this IQueryable< TSource > source, Expression< Func< TSource, TKey >> keySelector)
Groups the elements of a sequence according to a specified key selector function.
Definition: Queryable.cs:876
static IOrderedQueryable< TSource > ThenBy< TSource, TKey >(this IOrderedQueryable< TSource > source, Expression< Func< TSource, TKey >> keySelector)
Performs a subsequent ordering of the elements in a sequence in ascending order according to a key.
Definition: Queryable.cs:626
static ? double Average(this IQueryable< int?> source)
Computes the average of a sequence of nullable T:System.Int32 values.
Definition: Queryable.cs:2501
static IQueryable< TSource > Except< TSource >(this IQueryable< TSource > source1, IEnumerable< TSource > source2)
Produces the set difference of two sequences by using the default equality comparer to compare values...
Definition: Queryable.cs:1321
static int Sum< TSource >(this IQueryable< TSource > source, Expression< Func< TSource, int >> selector)
Computes the sum of the sequence of T:System.Int32 values that is obtained by invoking a projection f...
Definition: Queryable.cs:2231
static IQueryable< TResult > OfType< TResult >(this IQueryable source)
Filters the elements of an T:System.Linq.IQueryable based on a specified type.
Definition: Queryable.cs:145
static TSource Single< TSource >(this IQueryable< TSource > source)
Returns the only element of a sequence, and throws an exception if there is not exactly one element i...
Definition: Queryable.cs:1546
Provides a set of static (Shared in Visual Basic) methods for querying data structures that implement...
Definition: Queryable.cs:10
static TSource First< TSource >(this IQueryable< TSource > source)
Returns the first element of a sequence.
Definition: Queryable.cs:1373