2010-03-24 Jb Evain <jbevain@novell.com>
[mcs.git] / class / System.Core / System.Linq / Check.cs
blobcd8f504c29ee8d4c121191b3646bbc00c26e7490
1 //
2 // Check.cs
3 //
4 // Author:
5 // Jb Evain (jbevain@novell.com)
6 //
7 // Copyright (C) 2007 Novell, Inc (http://www.novell.com)
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 using System;
31 namespace System.Linq {
33 static class Check {
35 public static void Source (object source)
37 if (source == null)
38 throw new ArgumentNullException ("source");
41 public static void Source1AndSource2 (object source1,object source2)
43 if (source1 == null)
44 throw new ArgumentNullException ("source1");
45 if (source2 == null)
46 throw new ArgumentNullException ("source2");
49 public static void SourceAndFuncAndSelector ( object source, object func, object selector)
51 if (source == null)
52 throw new ArgumentNullException ("source");
53 if (func == null)
54 throw new ArgumentNullException ("func");
55 if (selector == null)
56 throw new ArgumentNullException ("selector");
60 public static void SourceAndFunc (object source, object func)
62 if (source == null)
63 throw new ArgumentNullException ("source");
64 if (func == null)
65 throw new ArgumentNullException ("func");
68 public static void SourceAndSelector (object source, object selector)
70 if (source == null)
71 throw new ArgumentNullException ("source");
72 if (selector == null)
73 throw new ArgumentNullException ("selector");
76 public static void SourceAndPredicate (object source, object predicate)
78 if (source == null)
79 throw new ArgumentNullException ("source");
80 if (predicate == null)
81 throw new ArgumentNullException ("predicate");
84 public static void FirstAndSecond (object first, object second)
86 if (first == null)
87 throw new ArgumentNullException ("first");
88 if (second == null)
89 throw new ArgumentNullException ("second");
92 public static void SourceAndKeySelector (object source, object keySelector)
94 if (source == null)
95 throw new ArgumentNullException ("source");
96 if (keySelector == null)
97 throw new ArgumentNullException ("keySelector");
100 public static void SourceAndKeyElementSelectors (object source, object keySelector, object elementSelector)
102 if (source == null)
103 throw new ArgumentNullException ("source");
104 if (keySelector == null)
105 throw new ArgumentNullException ("keySelector");
106 if (elementSelector == null)
107 throw new ArgumentNullException ("elementSelector");
109 public static void SourceAndKeyResultSelectors (object source, object keySelector, object resultSelector)
111 if (source == null)
112 throw new ArgumentNullException ("source");
113 if (keySelector == null)
114 throw new ArgumentNullException ("keySelector");
115 if (resultSelector == null)
116 throw new ArgumentNullException ("resultSelector");
119 public static void SourceAndCollectionSelectorAndResultSelector (object source, object collectionSelector, object resultSelector)
121 if (source == null)
122 throw new ArgumentNullException ("source");
123 if (collectionSelector == null)
124 throw new ArgumentNullException ("collectionSelector");
125 if (resultSelector == null)
126 throw new ArgumentNullException ("resultSelector");
129 public static void SourceAndCollectionSelectors (object source, object collectionSelector, object selector)
131 if (source == null)
132 throw new ArgumentNullException ("source");
133 if (collectionSelector == null)
134 throw new ArgumentNullException ("collectionSelector");
135 if (selector == null)
136 throw new ArgumentNullException ("selector");
139 public static void JoinSelectors (object outer, object inner, object outerKeySelector, object innerKeySelector, object resultSelector)
141 if (outer == null)
142 throw new ArgumentNullException ("outer");
143 if (inner == null)
144 throw new ArgumentNullException ("inner");
145 if (outerKeySelector == null)
146 throw new ArgumentNullException ("outerKeySelector");
147 if (innerKeySelector == null)
148 throw new ArgumentNullException ("innerKeySelector");
149 if (resultSelector == null)
150 throw new ArgumentNullException ("resultSelector");
153 public static void GroupBySelectors (object source, object keySelector, object elementSelector, object resultSelector)
155 if (source == null)
156 throw new ArgumentNullException ("source");
157 if (keySelector == null)
158 throw new ArgumentNullException ("keySelector");
159 if (elementSelector == null)
160 throw new ArgumentNullException ("elementSelector");
161 if (resultSelector == null)
162 throw new ArgumentNullException ("resultSelector");