Debian Codegraph @

external/rx/Rx/NET/Source/System.Reactive.Linq/Reactive/Linq/Observable.Async.cs

raw
1 // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
2
3 using System.Reactive.Concurrency;
4 using System.Threading;
5
6 #if !NO_TPL
7 using System.Threading.Tasks;
8 #endif
9
10 namespace System.Reactive.Linq
11 {
12 public static partial class Observable
13 {
14 #region FromAsyncPattern
15
16 #region Func
17
18 /// <summary>
19 /// Converts a Begin/End invoke function pair into an asynchronous function.
20 /// </summary>
21 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
22 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
23 /// <param name="end">The delegate that ends the asynchronous operation.</param>
24 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
25 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
26 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
27 #if PREFER_ASYNC
28 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
29 #endif
30 public static Func<IObservable<TResult>> FromAsyncPattern<TResult>(Func<AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
31 {
32 if (begin == null)
33 throw new ArgumentNullException("begin");
34 if (end == null)
35 throw new ArgumentNullException("end");
36
37 return s_impl.FromAsyncPattern<TResult>(begin, end);
38 }
39
40 /// <summary>
41 /// Converts a Begin/End invoke function pair into an asynchronous function.
42 /// </summary>
43 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
44 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
45 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
46 /// <param name="end">The delegate that ends the asynchronous operation.</param>
47 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
48 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
49 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
50 #if PREFER_ASYNC
51 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
52 #endif
53 public static Func<TArg1, IObservable<TResult>> FromAsyncPattern<TArg1, TResult>(Func<TArg1, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
54 {
55 if (begin == null)
56 throw new ArgumentNullException("begin");
57 if (end == null)
58 throw new ArgumentNullException("end");
59
60 return s_impl.FromAsyncPattern<TArg1, TResult>(begin, end);
61 }
62
63 /// <summary>
64 /// Converts a Begin/End invoke function pair into an asynchronous function.
65 /// </summary>
66 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
67 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
68 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
69 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
70 /// <param name="end">The delegate that ends the asynchronous operation.</param>
71 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
72 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
73 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
74 #if PREFER_ASYNC
75 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
76 #endif
77 public static Func<TArg1, TArg2, IObservable<TResult>> FromAsyncPattern<TArg1, TArg2, TResult>(Func<TArg1, TArg2, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
78 {
79 if (begin == null)
80 throw new ArgumentNullException("begin");
81 if (end == null)
82 throw new ArgumentNullException("end");
83
84 return s_impl.FromAsyncPattern<TArg1, TArg2, TResult>(begin, end);
85 }
86
87 #if !NO_LARGEARITY
88 /// <summary>
89 /// Converts a Begin/End invoke function pair into an asynchronous function.
90 /// </summary>
91 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
92 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
93 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
94 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
95 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
96 /// <param name="end">The delegate that ends the asynchronous operation.</param>
97 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
98 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
99 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
100 #if PREFER_ASYNC
101 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
102 #endif
103 public static Func<TArg1, TArg2, TArg3, IObservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TResult>(Func<TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
104 {
105 if (begin == null)
106 throw new ArgumentNullException("begin");
107 if (end == null)
108 throw new ArgumentNullException("end");
109
110 return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TResult>(begin, end);
111 }
112
113 /// <summary>
114 /// Converts a Begin/End invoke function pair into an asynchronous function.
115 /// </summary>
116 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
117 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
118 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
119 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
120 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
121 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
122 /// <param name="end">The delegate that ends the asynchronous operation.</param>
123 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
124 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
125 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
126 #if PREFER_ASYNC
127 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
128 #endif
129 public static Func<TArg1, TArg2, TArg3, TArg4, IObservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TResult>(Func<TArg1, TArg2, TArg3, TArg4, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
130 {
131 if (begin == null)
132 throw new ArgumentNullException("begin");
133 if (end == null)
134 throw new ArgumentNullException("end");
135
136 return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TResult>(begin, end);
137 }
138
139 /// <summary>
140 /// Converts a Begin/End invoke function pair into an asynchronous function.
141 /// </summary>
142 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
143 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
144 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
145 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
146 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
147 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
148 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
149 /// <param name="end">The delegate that ends the asynchronous operation.</param>
150 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
151 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
152 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
153 #if PREFER_ASYNC
154 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
155 #endif
156 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, IObservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
157 {
158 if (begin == null)
159 throw new ArgumentNullException("begin");
160 if (end == null)
161 throw new ArgumentNullException("end");
162
163 return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>(begin, end);
164 }
165
166 /// <summary>
167 /// Converts a Begin/End invoke function pair into an asynchronous function.
168 /// </summary>
169 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
170 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
171 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
172 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
173 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
174 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
175 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
176 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
177 /// <param name="end">The delegate that ends the asynchronous operation.</param>
178 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
179 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
180 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
181 #if PREFER_ASYNC
182 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
183 #endif
184 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, IObservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
185 {
186 if (begin == null)
187 throw new ArgumentNullException("begin");
188 if (end == null)
189 throw new ArgumentNullException("end");
190
191 return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>(begin, end);
192 }
193
194 /// <summary>
195 /// Converts a Begin/End invoke function pair into an asynchronous function.
196 /// </summary>
197 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
198 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
199 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
200 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
201 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
202 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
203 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
204 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
205 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
206 /// <param name="end">The delegate that ends the asynchronous operation.</param>
207 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
208 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
209 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
210 #if PREFER_ASYNC
211 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
212 #endif
213 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, IObservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
214 {
215 if (begin == null)
216 throw new ArgumentNullException("begin");
217 if (end == null)
218 throw new ArgumentNullException("end");
219
220 return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>(begin, end);
221 }
222
223 /// <summary>
224 /// Converts a Begin/End invoke function pair into an asynchronous function.
225 /// </summary>
226 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
227 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
228 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
229 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
230 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
231 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
232 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
233 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
234 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
235 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
236 /// <param name="end">The delegate that ends the asynchronous operation.</param>
237 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
238 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
239 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
240 #if PREFER_ASYNC
241 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
242 #endif
243 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, IObservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
244 {
245 if (begin == null)
246 throw new ArgumentNullException("begin");
247 if (end == null)
248 throw new ArgumentNullException("end");
249
250 return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>(begin, end);
251 }
252
253 /// <summary>
254 /// Converts a Begin/End invoke function pair into an asynchronous function.
255 /// </summary>
256 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
257 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
258 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
259 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
260 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
261 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
262 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
263 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
264 /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
265 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
266 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
267 /// <param name="end">The delegate that ends the asynchronous operation.</param>
268 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
269 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
270 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
271 #if PREFER_ASYNC
272 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
273 #endif
274 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, IObservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
275 {
276 if (begin == null)
277 throw new ArgumentNullException("begin");
278 if (end == null)
279 throw new ArgumentNullException("end");
280
281 return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>(begin, end);
282 }
283
284 /// <summary>
285 /// Converts a Begin/End invoke function pair into an asynchronous function.
286 /// </summary>
287 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
288 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
289 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
290 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
291 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
292 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
293 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
294 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
295 /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
296 /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
297 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
298 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
299 /// <param name="end">The delegate that ends the asynchronous operation.</param>
300 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
301 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
302 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
303 #if PREFER_ASYNC
304 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
305 #endif
306 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, IObservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
307 {
308 if (begin == null)
309 throw new ArgumentNullException("begin");
310 if (end == null)
311 throw new ArgumentNullException("end");
312
313 return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>(begin, end);
314 }
315
316 /// <summary>
317 /// Converts a Begin/End invoke function pair into an asynchronous function.
318 /// </summary>
319 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
320 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
321 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
322 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
323 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
324 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
325 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
326 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
327 /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
328 /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
329 /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
330 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
331 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
332 /// <param name="end">The delegate that ends the asynchronous operation.</param>
333 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
334 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
335 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
336 #if PREFER_ASYNC
337 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
338 #endif
339 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, IObservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
340 {
341 if (begin == null)
342 throw new ArgumentNullException("begin");
343 if (end == null)
344 throw new ArgumentNullException("end");
345
346 return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>(begin, end);
347 }
348
349 /// <summary>
350 /// Converts a Begin/End invoke function pair into an asynchronous function.
351 /// </summary>
352 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
353 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
354 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
355 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
356 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
357 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
358 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
359 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
360 /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
361 /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
362 /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
363 /// <typeparam name="TArg12">The type of the twelfth argument passed to the begin delegate.</typeparam>
364 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
365 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
366 /// <param name="end">The delegate that ends the asynchronous operation.</param>
367 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
368 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
369 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
370 #if PREFER_ASYNC
371 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
372 #endif
373 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, IObservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
374 {
375 if (begin == null)
376 throw new ArgumentNullException("begin");
377 if (end == null)
378 throw new ArgumentNullException("end");
379
380 return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>(begin, end);
381 }
382
383 /// <summary>
384 /// Converts a Begin/End invoke function pair into an asynchronous function.
385 /// </summary>
386 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
387 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
388 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
389 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
390 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
391 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
392 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
393 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
394 /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
395 /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
396 /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
397 /// <typeparam name="TArg12">The type of the twelfth argument passed to the begin delegate.</typeparam>
398 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the begin delegate.</typeparam>
399 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
400 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
401 /// <param name="end">The delegate that ends the asynchronous operation.</param>
402 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
403 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
404 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
405 #if PREFER_ASYNC
406 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
407 #endif
408 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, IObservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
409 {
410 if (begin == null)
411 throw new ArgumentNullException("begin");
412 if (end == null)
413 throw new ArgumentNullException("end");
414
415 return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>(begin, end);
416 }
417
418 /// <summary>
419 /// Converts a Begin/End invoke function pair into an asynchronous function.
420 /// </summary>
421 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
422 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
423 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
424 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
425 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
426 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
427 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
428 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
429 /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
430 /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
431 /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
432 /// <typeparam name="TArg12">The type of the twelfth argument passed to the begin delegate.</typeparam>
433 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the begin delegate.</typeparam>
434 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the begin delegate.</typeparam>
435 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
436 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
437 /// <param name="end">The delegate that ends the asynchronous operation.</param>
438 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
439 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
440 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
441 #if PREFER_ASYNC
442 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
443 #endif
444 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, IObservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
445 {
446 if (begin == null)
447 throw new ArgumentNullException("begin");
448 if (end == null)
449 throw new ArgumentNullException("end");
450
451 return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>(begin, end);
452 }
453 #endif
454
455 #endregion
456
457 #region Action
458
459 /// <summary>
460 /// Converts a Begin/End invoke function pair into an asynchronous function.
461 /// </summary>
462 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
463 /// <param name="end">The delegate that ends the asynchronous operation.</param>
464 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
465 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
466 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
467 #if PREFER_ASYNC
468 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
469 #endif
470 public static Func<IObservable<Unit>> FromAsyncPattern(Func<AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
471 {
472 if (begin == null)
473 throw new ArgumentNullException("begin");
474 if (end == null)
475 throw new ArgumentNullException("end");
476
477 return s_impl.FromAsyncPattern(begin, end);
478 }
479
480 /// <summary>
481 /// Converts a Begin/End invoke function pair into an asynchronous function.
482 /// </summary>
483 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
484 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
485 /// <param name="end">The delegate that ends the asynchronous operation.</param>
486 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
487 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
488 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
489 #if PREFER_ASYNC
490 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
491 #endif
492 public static Func<TArg1, IObservable<Unit>> FromAsyncPattern<TArg1>(Func<TArg1, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
493 {
494 if (begin == null)
495 throw new ArgumentNullException("begin");
496 if (end == null)
497 throw new ArgumentNullException("end");
498
499 return s_impl.FromAsyncPattern<TArg1>(begin, end);
500 }
501
502 /// <summary>
503 /// Converts a Begin/End invoke function pair into an asynchronous function.
504 /// </summary>
505 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
506 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
507 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
508 /// <param name="end">The delegate that ends the asynchronous operation.</param>
509 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
510 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
511 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
512 #if PREFER_ASYNC
513 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
514 #endif
515 public static Func<TArg1, TArg2, IObservable<Unit>> FromAsyncPattern<TArg1, TArg2>(Func<TArg1, TArg2, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
516 {
517 if (begin == null)
518 throw new ArgumentNullException("begin");
519 if (end == null)
520 throw new ArgumentNullException("end");
521
522 return s_impl.FromAsyncPattern<TArg1, TArg2>(begin, end);
523 }
524
525 #if !NO_LARGEARITY
526 /// <summary>
527 /// Converts a Begin/End invoke function pair into an asynchronous function.
528 /// </summary>
529 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
530 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
531 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
532 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
533 /// <param name="end">The delegate that ends the asynchronous operation.</param>
534 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
535 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
536 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
537 #if PREFER_ASYNC
538 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
539 #endif
540 public static Func<TArg1, TArg2, TArg3, IObservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3>(Func<TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
541 {
542 if (begin == null)
543 throw new ArgumentNullException("begin");
544 if (end == null)
545 throw new ArgumentNullException("end");
546
547 return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3>(begin, end);
548 }
549
550 /// <summary>
551 /// Converts a Begin/End invoke function pair into an asynchronous function.
552 /// </summary>
553 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
554 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
555 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
556 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
557 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
558 /// <param name="end">The delegate that ends the asynchronous operation.</param>
559 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
560 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
561 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
562 #if PREFER_ASYNC
563 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
564 #endif
565 public static Func<TArg1, TArg2, TArg3, TArg4, IObservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4>(Func<TArg1, TArg2, TArg3, TArg4, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
566 {
567 if (begin == null)
568 throw new ArgumentNullException("begin");
569 if (end == null)
570 throw new ArgumentNullException("end");
571
572 return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4>(begin, end);
573 }
574
575 /// <summary>
576 /// Converts a Begin/End invoke function pair into an asynchronous function.
577 /// </summary>
578 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
579 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
580 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
581 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
582 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
583 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
584 /// <param name="end">The delegate that ends the asynchronous operation.</param>
585 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
586 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
587 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
588 #if PREFER_ASYNC
589 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
590 #endif
591 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, IObservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
592 {
593 if (begin == null)
594 throw new ArgumentNullException("begin");
595 if (end == null)
596 throw new ArgumentNullException("end");
597
598 return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5>(begin, end);
599 }
600
601 /// <summary>
602 /// Converts a Begin/End invoke function pair into an asynchronous function.
603 /// </summary>
604 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
605 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
606 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
607 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
608 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
609 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
610 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
611 /// <param name="end">The delegate that ends the asynchronous operation.</param>
612 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
613 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
614 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
615 #if PREFER_ASYNC
616 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
617 #endif
618 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, IObservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
619 {
620 if (begin == null)
621 throw new ArgumentNullException("begin");
622 if (end == null)
623 throw new ArgumentNullException("end");
624
625 return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>(begin, end);
626 }
627
628 /// <summary>
629 /// Converts a Begin/End invoke function pair into an asynchronous function.
630 /// </summary>
631 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
632 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
633 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
634 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
635 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
636 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
637 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
638 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
639 /// <param name="end">The delegate that ends the asynchronous operation.</param>
640 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
641 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
642 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
643 #if PREFER_ASYNC
644 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
645 #endif
646 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, IObservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
647 {
648 if (begin == null)
649 throw new ArgumentNullException("begin");
650 if (end == null)
651 throw new ArgumentNullException("end");
652
653 return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>(begin, end);
654 }
655
656 /// <summary>
657 /// Converts a Begin/End invoke function pair into an asynchronous function.
658 /// </summary>
659 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
660 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
661 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
662 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
663 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
664 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
665 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
666 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
667 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
668 /// <param name="end">The delegate that ends the asynchronous operation.</param>
669 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
670 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
671 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
672 #if PREFER_ASYNC
673 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
674 #endif
675 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, IObservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
676 {
677 if (begin == null)
678 throw new ArgumentNullException("begin");
679 if (end == null)
680 throw new ArgumentNullException("end");
681
682 return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>(begin, end);
683 }
684
685 /// <summary>
686 /// Converts a Begin/End invoke function pair into an asynchronous function.
687 /// </summary>
688 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
689 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
690 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
691 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
692 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
693 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
694 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
695 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
696 /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
697 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
698 /// <param name="end">The delegate that ends the asynchronous operation.</param>
699 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
700 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
701 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
702 #if PREFER_ASYNC
703 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
704 #endif
705 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, IObservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
706 {
707 if (begin == null)
708 throw new ArgumentNullException("begin");
709 if (end == null)
710 throw new ArgumentNullException("end");
711
712 return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>(begin, end);
713 }
714
715 /// <summary>
716 /// Converts a Begin/End invoke function pair into an asynchronous function.
717 /// </summary>
718 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
719 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
720 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
721 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
722 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
723 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
724 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
725 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
726 /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
727 /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
728 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
729 /// <param name="end">The delegate that ends the asynchronous operation.</param>
730 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
731 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
732 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
733 #if PREFER_ASYNC
734 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
735 #endif
736 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, IObservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
737 {
738 if (begin == null)
739 throw new ArgumentNullException("begin");
740 if (end == null)
741 throw new ArgumentNullException("end");
742
743 return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>(begin, end);
744 }
745
746 /// <summary>
747 /// Converts a Begin/End invoke function pair into an asynchronous function.
748 /// </summary>
749 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
750 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
751 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
752 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
753 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
754 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
755 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
756 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
757 /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
758 /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
759 /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
760 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
761 /// <param name="end">The delegate that ends the asynchronous operation.</param>
762 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
763 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
764 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
765 #if PREFER_ASYNC
766 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
767 #endif
768 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, IObservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
769 {
770 if (begin == null)
771 throw new ArgumentNullException("begin");
772 if (end == null)
773 throw new ArgumentNullException("end");
774
775 return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>(begin, end);
776 }
777
778 /// <summary>
779 /// Converts a Begin/End invoke function pair into an asynchronous function.
780 /// </summary>
781 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
782 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
783 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
784 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
785 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
786 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
787 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
788 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
789 /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
790 /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
791 /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
792 /// <typeparam name="TArg12">The type of the twelfth argument passed to the begin delegate.</typeparam>
793 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
794 /// <param name="end">The delegate that ends the asynchronous operation.</param>
795 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
796 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
797 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
798 #if PREFER_ASYNC
799 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
800 #endif
801 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, IObservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
802 {
803 if (begin == null)
804 throw new ArgumentNullException("begin");
805 if (end == null)
806 throw new ArgumentNullException("end");
807
808 return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>(begin, end);
809 }
810
811 /// <summary>
812 /// Converts a Begin/End invoke function pair into an asynchronous function.
813 /// </summary>
814 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
815 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
816 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
817 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
818 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
819 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
820 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
821 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
822 /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
823 /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
824 /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
825 /// <typeparam name="TArg12">The type of the twelfth argument passed to the begin delegate.</typeparam>
826 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the begin delegate.</typeparam>
827 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
828 /// <param name="end">The delegate that ends the asynchronous operation.</param>
829 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
830 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
831 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
832 #if PREFER_ASYNC
833 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
834 #endif
835 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, IObservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
836 {
837 if (begin == null)
838 throw new ArgumentNullException("begin");
839 if (end == null)
840 throw new ArgumentNullException("end");
841
842 return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>(begin, end);
843 }
844
845 /// <summary>
846 /// Converts a Begin/End invoke function pair into an asynchronous function.
847 /// </summary>
848 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
849 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
850 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
851 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
852 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
853 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
854 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
855 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
856 /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
857 /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
858 /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
859 /// <typeparam name="TArg12">The type of the twelfth argument passed to the begin delegate.</typeparam>
860 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the begin delegate.</typeparam>
861 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the begin delegate.</typeparam>
862 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
863 /// <param name="end">The delegate that ends the asynchronous operation.</param>
864 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
865 /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
866 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
867 #if PREFER_ASYNC
868 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
869 #endif
870 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, IObservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
871 {
872 if (begin == null)
873 throw new ArgumentNullException("begin");
874 if (end == null)
875 throw new ArgumentNullException("end");
876
877 return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>(begin, end);
878 }
879 #endif
880
881 #endregion
882
883 #endregion
884
885 #region Start[Async]
886
887 #region Func
888
889 /// <summary>
890 /// Invokes the specified function asynchronously, surfacing the result through an observable sequence.
891 /// </summary>
892 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
893 /// <param name="function">Function to run asynchronously.</param>
894 /// <returns>An observable sequence exposing the function's result value, or an exception.</returns>
895 /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
896 /// <remarks>
897 /// <list type="bullet">
898 /// <item><description>The function is called immediately, not during the subscription of the resulting sequence.</description></item>
899 /// <item><description>Multiple subscriptions to the resulting sequence can observe the function's result.</description></item>
900 /// </list>
901 /// </remarks>
902 public static IObservable<TResult> Start<TResult>(Func<TResult> function)
903 {
904 if (function == null)
905 throw new ArgumentNullException("function");
906
907 return s_impl.Start<TResult>(function);
908 }
909
910 /// <summary>
911 /// Invokes the specified function asynchronously on the specified scheduler, surfacing the result through an observable sequence
912 /// </summary>
913 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
914 /// <param name="function">Function to run asynchronously.</param>
915 /// <param name="scheduler">Scheduler to run the function on.</param>
916 /// <returns>An observable sequence exposing the function's result value, or an exception.</returns>
917 /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
918 /// <remarks>
919 /// <list type="bullet">
920 /// <item><description>The function is called immediately, not during the subscription of the resulting sequence.</description></item>
921 /// <item><description>Multiple subscriptions to the resulting sequence can observe the function's result.</description></item>
922 /// </list>
923 /// </remarks>
924 public static IObservable<TResult> Start<TResult>(Func<TResult> function, IScheduler scheduler)
925 {
926 if (function == null)
927 throw new ArgumentNullException("function");
928 if (scheduler == null)
929 throw new ArgumentNullException("scheduler");
930
931 return s_impl.Start<TResult>(function, scheduler);
932 }
933
934 #if !NO_TPL
935 /// <summary>
936 /// Invokes the asynchronous function, surfacing the result through an observable sequence.
937 /// </summary>
938 /// <typeparam name="TResult">The type of the result returned by the asynchronous function.</typeparam>
939 /// <param name="functionAsync">Asynchronous function to run.</param>
940 /// <returns>An observable sequence exposing the function's result value, or an exception.</returns>
941 /// <exception cref="ArgumentNullException"><paramref name="functionAsync"/> is null.</exception>
942 /// <remarks>
943 /// <list type="bullet">
944 /// <item><description>The function is started immediately, not during the subscription of the resulting sequence.</description></item>
945 /// <item><description>Multiple subscriptions to the resulting sequence can observe the function's result.</description></item>
946 /// </list>
947 /// </remarks>
948 public static IObservable<TResult> StartAsync<TResult>(Func<Task<TResult>> functionAsync)
949 {
950 if (functionAsync == null)
951 throw new ArgumentNullException("functionAsync");
952
953 return s_impl.StartAsync<TResult>(functionAsync);
954 }
955
956 /// <summary>
957 /// Invokes the asynchronous function, surfacing the result through an observable sequence.
958 /// The CancellationToken is shared by all subscriptions on the resulting observable sequence. See the remarks section for more information.
959 /// </summary>
960 /// <typeparam name="TResult">The type of the result returned by the asynchronous function.</typeparam>
961 /// <param name="functionAsync">Asynchronous function to run.</param>
962 /// <returns>An observable sequence exposing the function's result value, or an exception.</returns>
963 /// <exception cref="ArgumentNullException"><paramref name="functionAsync"/> is null.</exception>
964 /// <remarks>
965 /// <list type="bullet">
966 /// <item><description>The function is started immediately, not during the subscription of the resulting sequence.</description></item>
967 /// <item><description>Multiple subscriptions to the resulting sequence can observe the function's result.</description></item>
968 /// <item><description>
969 /// If any subscription to the resulting sequence is disposed, the CancellationToken is set. The observer associated to the disposed
970 /// subscription won't see the TaskCanceledException, but other observers will. You can protect against this using the Catch operator.
971 /// Be careful when handing out the resulting sequence because of this behavior. The most common use is to have a single subscription
972 /// to the resulting sequence, which controls the CancellationToken state. Alternatively, you can control subscription behavior using
973 /// multicast operators.
974 /// </description></item>
975 /// </list>
976 /// </remarks>
977 public static IObservable<TResult> StartAsync<TResult>(Func<CancellationToken, Task<TResult>> functionAsync)
978 {
979 if (functionAsync == null)
980 throw new ArgumentNullException("functionAsync");
981
982 return s_impl.StartAsync<TResult>(functionAsync);
983 }
984 #endif
985
986 #endregion
987
988 #region Action
989
990 /// <summary>
991 /// Invokes the action asynchronously, surfacing the result through an observable sequence.
992 /// </summary>
993 /// <param name="action">Action to run asynchronously.</param>
994 /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
995 /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
996 /// <remarks>
997 /// <list type="bullet">
998 /// <item><description>The action is called immediately, not during the subscription of the resulting sequence.</description></item>
999 /// <item><description>Multiple subscriptions to the resulting sequence can observe the action's outcome.</description></item>
1000 /// </list>
1001 /// </remarks>
1002 public static IObservable<Unit> Start(Action action)
1003 {
1004 if (action == null)
1005 throw new ArgumentNullException("action");
1006
1007 return s_impl.Start(action);
1008 }
1009
1010 /// <summary>
1011 /// Invokes the action asynchronously on the specified scheduler, surfacing the result through an observable sequence.
1012 /// </summary>
1013 /// <param name="action">Action to run asynchronously.</param>
1014 /// <param name="scheduler">Scheduler to run the action on.</param>
1015 /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
1016 /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
1017 /// <remarks>
1018 /// <list type="bullet">
1019 /// <item><description>The action is called immediately, not during the subscription of the resulting sequence.</description></item>
1020 /// <item><description>Multiple subscriptions to the resulting sequence can observe the action's outcome.</description></item>
1021 /// </list>
1022 /// </remarks>
1023 public static IObservable<Unit> Start(Action action, IScheduler scheduler)
1024 {
1025 if (action == null)
1026 throw new ArgumentNullException("action");
1027 if (scheduler == null)
1028 throw new ArgumentNullException("scheduler");
1029
1030 return s_impl.Start(action, scheduler);
1031 }
1032
1033 #if !NO_TPL
1034 /// <summary>
1035 /// Invokes the asynchronous action, surfacing the result through an observable sequence.
1036 /// </summary>
1037 /// <param name="actionAsync">Asynchronous action to run.</param>
1038 /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
1039 /// <exception cref="ArgumentNullException"><paramref name="actionAsync"/> is null.</exception>
1040 /// <remarks>
1041 /// <list type="bullet">
1042 /// <item><description>The action is started immediately, not during the subscription of the resulting sequence.</description></item>
1043 /// <item><description>Multiple subscriptions to the resulting sequence can observe the action's outcome.</description></item>
1044 /// </list>
1045 /// </remarks>
1046 public static IObservable<Unit> StartAsync(Func<Task> actionAsync)
1047 {
1048 if (actionAsync == null)
1049 throw new ArgumentNullException("actionAsync");
1050
1051 return s_impl.StartAsync(actionAsync);
1052 }
1053
1054 /// <summary>
1055 /// Invokes the asynchronous action, surfacing the result through an observable sequence.
1056 /// The CancellationToken is shared by all subscriptions on the resulting observable sequence. See the remarks section for more information.
1057 /// </summary>
1058 /// <param name="actionAsync">Asynchronous action to run.</param>
1059 /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
1060 /// <exception cref="ArgumentNullException"><paramref name="actionAsync"/> is null.</exception>
1061 /// <remarks>
1062 /// <list type="bullet">
1063 /// <item><description>The action is started immediately, not during the subscription of the resulting sequence.</description></item>
1064 /// <item><description>Multiple subscriptions to the resulting sequence can observe the action's outcome.</description></item>
1065 /// <item><description>
1066 /// If any subscription to the resulting sequence is disposed, the CancellationToken is set. The observer associated to the disposed
1067 /// subscription won't see the TaskCanceledException, but other observers will. You can protect against this using the Catch operator.
1068 /// Be careful when handing out the resulting sequence because of this behavior. The most common use is to have a single subscription
1069 /// to the resulting sequence, which controls the CancellationToken state. Alternatively, you can control subscription behavior using
1070 /// multicast operators.
1071 /// </description></item>
1072 /// </list>
1073 /// </remarks>
1074 public static IObservable<Unit> StartAsync(Func<CancellationToken, Task> actionAsync)
1075 {
1076 if (actionAsync == null)
1077 throw new ArgumentNullException("actionAsync");
1078
1079 return s_impl.StartAsync(actionAsync);
1080 }
1081 #endif
1082
1083 #endregion
1084
1085 #endregion
1086
1087 #region FromAsync
1088
1089 #if !NO_TPL
1090
1091 #region Func
1092
1093 /// <summary>
1094 /// Converts to asynchronous function into an observable sequence. Each subscription to the resulting sequence causes the function to be started.
1095 /// </summary>
1096 /// <typeparam name="TResult">The type of the result returned by the asynchronous function.</typeparam>
1097 /// <param name="functionAsync">Asynchronous function to convert.</param>
1098 /// <returns>An observable sequence exposing the result of invoking the function, or an exception.</returns>
1099 /// <exception cref="ArgumentNullException"><paramref name="functionAsync"/> is null.</exception>
1100 public static IObservable<TResult> FromAsync<TResult>(Func<Task<TResult>> functionAsync)
1101 {
1102 return s_impl.FromAsync<TResult>(functionAsync);
1103 }
1104
1105 /// <summary>
1106 /// Converts to asynchronous function into an observable sequence. Each subscription to the resulting sequence causes the function to be started.
1107 /// The CancellationToken passed to the asynchronous function is tied to the observable sequence's subscription that triggered the function's invocation and can be used for best-effort cancellation.
1108 /// </summary>
1109 /// <typeparam name="TResult">The type of the result returned by the asynchronous function.</typeparam>
1110 /// <param name="functionAsync">Asynchronous function to convert.</param>
1111 /// <returns>An observable sequence exposing the result of invoking the function, or an exception.</returns>
1112 /// <exception cref="ArgumentNullException"><paramref name="functionAsync"/> is null.</exception>
1113 /// <remarks>When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous function will be signaled.</remarks>
1114 public static IObservable<TResult> FromAsync<TResult>(Func<CancellationToken, Task<TResult>> functionAsync)
1115 {
1116 return s_impl.FromAsync<TResult>(functionAsync);
1117 }
1118
1119 #endregion
1120
1121 #region Action
1122
1123 /// <summary>
1124 /// Converts to asynchronous action into an observable sequence. Each subscription to the resulting sequence causes the action to be started.
1125 /// </summary>
1126 /// <param name="actionAsync">Asynchronous action to convert.</param>
1127 /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
1128 /// <exception cref="ArgumentNullException"><paramref name="actionAsync"/> is null.</exception>
1129 public static IObservable<Unit> FromAsync(Func<Task> actionAsync)
1130 {
1131 return s_impl.FromAsync(actionAsync);
1132 }
1133
1134 /// <summary>
1135 /// Converts to asynchronous action into an observable sequence. Each subscription to the resulting sequence causes the action to be started.
1136 /// The CancellationToken passed to the asynchronous action is tied to the observable sequence's subscription that triggered the action's invocation and can be used for best-effort cancellation.
1137 /// </summary>
1138 /// <param name="actionAsync">Asynchronous action to convert.</param>
1139 /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
1140 /// <remarks>When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous function will be signaled.</remarks>
1141 /// <exception cref="ArgumentNullException"><paramref name="actionAsync"/> is null.</exception>
1142 public static IObservable<Unit> FromAsync(Func<CancellationToken, Task> actionAsync)
1143 {
1144 return s_impl.FromAsync(actionAsync);
1145 }
1146
1147 #endregion
1148
1149 #endif
1150
1151 #endregion
1152
1153 #region ToAsync
1154
1155 #region Func
1156
1157 /// <summary>
1158 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
1159 /// </summary>
1160 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1161 /// <param name="function">Function to convert to an asynchronous function.</param>
1162 /// <returns>Asynchronous function.</returns>
1163 /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
1164 public static Func<IObservable<TResult>> ToAsync<TResult>(this Func<TResult> function)
1165 {
1166 if (function == null)
1167 throw new ArgumentNullException("function");
1168
1169 return s_impl.ToAsync<TResult>(function);
1170 }
1171
1172 /// <summary>
1173 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
1174 /// </summary>
1175 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1176 /// <param name="function">Function to convert to an asynchronous function.</param>
1177 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
1178 /// <returns>Asynchronous function.</returns>
1179 /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
1180 public static Func<IObservable<TResult>> ToAsync<TResult>(this Func<TResult> function, IScheduler scheduler)
1181 {
1182 if (function == null)
1183 throw new ArgumentNullException("function");
1184 if (scheduler == null)
1185 throw new ArgumentNullException("scheduler");
1186
1187 return s_impl.ToAsync<TResult>(function, scheduler);
1188 }
1189
1190 /// <summary>
1191 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
1192 /// </summary>
1193 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1194 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1195 /// <param name="function">Function to convert to an asynchronous function.</param>
1196 /// <returns>Asynchronous function.</returns>
1197 /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
1198 public static Func<TArg1, IObservable<TResult>> ToAsync<TArg1, TResult>(this Func<TArg1, TResult> function)
1199 {
1200 if (function == null)
1201 throw new ArgumentNullException("function");
1202
1203 return s_impl.ToAsync<TArg1, TResult>(function);
1204 }
1205
1206 /// <summary>
1207 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
1208 /// </summary>
1209 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1210 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1211 /// <param name="function">Function to convert to an asynchronous function.</param>
1212 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
1213 /// <returns>Asynchronous function.</returns>
1214 /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
1215 public static Func<TArg1, IObservable<TResult>> ToAsync<TArg1, TResult>(this Func<TArg1, TResult> function, IScheduler scheduler)
1216 {
1217 if (function == null)
1218 throw new ArgumentNullException("function");
1219 if (scheduler == null)
1220 throw new ArgumentNullException("scheduler");
1221
1222 return s_impl.ToAsync<TArg1, TResult>(function, scheduler);
1223 }
1224
1225 /// <summary>
1226 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
1227 /// </summary>
1228 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1229 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1230 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1231 /// <param name="function">Function to convert to an asynchronous function.</param>
1232 /// <returns>Asynchronous function.</returns>
1233 /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
1234 public static Func<TArg1, TArg2, IObservable<TResult>> ToAsync<TArg1, TArg2, TResult>(this Func<TArg1, TArg2, TResult> function)
1235 {
1236 if (function == null)
1237 throw new ArgumentNullException("function");
1238
1239 return s_impl.ToAsync<TArg1, TArg2, TResult>(function);
1240 }
1241
1242 /// <summary>
1243 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
1244 /// </summary>
1245 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1246 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1247 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1248 /// <param name="function">Function to convert to an asynchronous function.</param>
1249 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
1250 /// <returns>Asynchronous function.</returns>
1251 /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
1252 public static Func<TArg1, TArg2, IObservable<TResult>> ToAsync<TArg1, TArg2, TResult>(this Func<TArg1, TArg2, TResult> function, IScheduler scheduler)
1253 {
1254 if (function == null)
1255 throw new ArgumentNullException("function");
1256 if (scheduler == null)
1257 throw new ArgumentNullException("scheduler");
1258
1259 return s_impl.ToAsync<TArg1, TArg2, TResult>(function, scheduler);
1260 }
1261
1262 /// <summary>
1263 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
1264 /// </summary>
1265 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1266 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1267 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1268 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1269 /// <param name="function">Function to convert to an asynchronous function.</param>
1270 /// <returns>Asynchronous function.</returns>
1271 /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
1272 public static Func<TArg1, TArg2, TArg3, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TResult>(this Func<TArg1, TArg2, TArg3, TResult> function)
1273 {
1274 if (function == null)
1275 throw new ArgumentNullException("function");
1276
1277 return s_impl.ToAsync<TArg1, TArg2, TArg3, TResult>(function);
1278 }
1279
1280 /// <summary>
1281 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
1282 /// </summary>
1283 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1284 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1285 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1286 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1287 /// <param name="function">Function to convert to an asynchronous function.</param>
1288 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
1289 /// <returns>Asynchronous function.</returns>
1290 /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
1291 public static Func<TArg1, TArg2, TArg3, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TResult>(this Func<TArg1, TArg2, TArg3, TResult> function, IScheduler scheduler)
1292 {
1293 if (function == null)
1294 throw new ArgumentNullException("function");
1295 if (scheduler == null)
1296 throw new ArgumentNullException("scheduler");
1297
1298 return s_impl.ToAsync<TArg1, TArg2, TArg3, TResult>(function, scheduler);
1299 }
1300
1301 /// <summary>
1302 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
1303 /// </summary>
1304 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1305 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1306 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1307 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
1308 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1309 /// <param name="function">Function to convert to an asynchronous function.</param>
1310 /// <returns>Asynchronous function.</returns>
1311 /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
1312 public static Func<TArg1, TArg2, TArg3, TArg4, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TResult> function)
1313 {
1314 if (function == null)
1315 throw new ArgumentNullException("function");
1316
1317 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TResult>(function);
1318 }
1319
1320 /// <summary>
1321 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
1322 /// </summary>
1323 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1324 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1325 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1326 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
1327 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1328 /// <param name="function">Function to convert to an asynchronous function.</param>
1329 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
1330 /// <returns>Asynchronous function.</returns>
1331 /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
1332 public static Func<TArg1, TArg2, TArg3, TArg4, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TResult> function, IScheduler scheduler)
1333 {
1334 if (function == null)
1335 throw new ArgumentNullException("function");
1336 if (scheduler == null)
1337 throw new ArgumentNullException("scheduler");
1338
1339 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TResult>(function, scheduler);
1340 }
1341
1342 #if !NO_LARGEARITY
1343 /// <summary>
1344 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
1345 /// </summary>
1346 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1347 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1348 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1349 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
1350 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
1351 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1352 /// <param name="function">Function to convert to an asynchronous function.</param>
1353 /// <returns>Asynchronous function.</returns>
1354 /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
1355 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TResult> function)
1356 {
1357 if (function == null)
1358 throw new ArgumentNullException("function");
1359
1360 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>(function);
1361 }
1362
1363 /// <summary>
1364 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
1365 /// </summary>
1366 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1367 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1368 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1369 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
1370 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
1371 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1372 /// <param name="function">Function to convert to an asynchronous function.</param>
1373 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
1374 /// <returns>Asynchronous function.</returns>
1375 /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
1376 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TResult> function, IScheduler scheduler)
1377 {
1378 if (function == null)
1379 throw new ArgumentNullException("function");
1380 if (scheduler == null)
1381 throw new ArgumentNullException("scheduler");
1382
1383 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>(function, scheduler);
1384 }
1385
1386 /// <summary>
1387 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
1388 /// </summary>
1389 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1390 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1391 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1392 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
1393 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
1394 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
1395 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1396 /// <param name="function">Function to convert to an asynchronous function.</param>
1397 /// <returns>Asynchronous function.</returns>
1398 /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
1399 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult> function)
1400 {
1401 if (function == null)
1402 throw new ArgumentNullException("function");
1403
1404 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>(function);
1405 }
1406
1407 /// <summary>
1408 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
1409 /// </summary>
1410 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1411 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1412 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1413 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
1414 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
1415 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
1416 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1417 /// <param name="function">Function to convert to an asynchronous function.</param>
1418 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
1419 /// <returns>Asynchronous function.</returns>
1420 /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
1421 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult> function, IScheduler scheduler)
1422 {
1423 if (function == null)
1424 throw new ArgumentNullException("function");
1425 if (scheduler == null)
1426 throw new ArgumentNullException("scheduler");
1427
1428 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>(function, scheduler);
1429 }
1430
1431 /// <summary>
1432 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
1433 /// </summary>
1434 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1435 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1436 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1437 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
1438 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
1439 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
1440 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
1441 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1442 /// <param name="function">Function to convert to an asynchronous function.</param>
1443 /// <returns>Asynchronous function.</returns>
1444 /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
1445 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult> function)
1446 {
1447 if (function == null)
1448 throw new ArgumentNullException("function");
1449
1450 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>(function);
1451 }
1452
1453 /// <summary>
1454 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
1455 /// </summary>
1456 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1457 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1458 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1459 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
1460 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
1461 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
1462 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
1463 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1464 /// <param name="function">Function to convert to an asynchronous function.</param>
1465 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
1466 /// <returns>Asynchronous function.</returns>
1467 /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
1468 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult> function, IScheduler scheduler)
1469 {
1470 if (function == null)
1471 throw new ArgumentNullException("function");
1472 if (scheduler == null)
1473 throw new ArgumentNullException("scheduler");
1474
1475 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>(function, scheduler);
1476 }
1477
1478 /// <summary>
1479 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
1480 /// </summary>
1481 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1482 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1483 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1484 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
1485 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
1486 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
1487 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
1488 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
1489 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1490 /// <param name="function">Function to convert to an asynchronous function.</param>
1491 /// <returns>Asynchronous function.</returns>
1492 /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
1493 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult> function)
1494 {
1495 if (function == null)
1496 throw new ArgumentNullException("function");
1497
1498 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>(function);
1499 }
1500
1501 /// <summary>
1502 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
1503 /// </summary>
1504 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1505 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1506 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1507 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
1508 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
1509 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
1510 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
1511 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
1512 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1513 /// <param name="function">Function to convert to an asynchronous function.</param>
1514 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
1515 /// <returns>Asynchronous function.</returns>
1516 /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
1517 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult> function, IScheduler scheduler)
1518 {
1519 if (function == null)
1520 throw new ArgumentNullException("function");
1521 if (scheduler == null)
1522 throw new ArgumentNullException("scheduler");
1523
1524 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>(function, scheduler);
1525 }
1526
1527 /// <summary>
1528 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
1529 /// </summary>
1530 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1531 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1532 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1533 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
1534 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
1535 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
1536 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
1537 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
1538 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
1539 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1540 /// <param name="function">Function to convert to an asynchronous function.</param>
1541 /// <returns>Asynchronous function.</returns>
1542 /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
1543 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult> function)
1544 {
1545 if (function == null)
1546 throw new ArgumentNullException("function");
1547
1548 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>(function);
1549 }
1550
1551 /// <summary>
1552 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
1553 /// </summary>
1554 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1555 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1556 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1557 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
1558 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
1559 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
1560 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
1561 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
1562 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
1563 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1564 /// <param name="function">Function to convert to an asynchronous function.</param>
1565 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
1566 /// <returns>Asynchronous function.</returns>
1567 /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
1568 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult> function, IScheduler scheduler)
1569 {
1570 if (function == null)
1571 throw new ArgumentNullException("function");
1572 if (scheduler == null)
1573 throw new ArgumentNullException("scheduler");
1574
1575 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>(function, scheduler);
1576 }
1577
1578 /// <summary>
1579 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
1580 /// </summary>
1581 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1582 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1583 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1584 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
1585 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
1586 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
1587 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
1588 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
1589 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
1590 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
1591 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1592 /// <param name="function">Function to convert to an asynchronous function.</param>
1593 /// <returns>Asynchronous function.</returns>
1594 /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
1595 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult> function)
1596 {
1597 if (function == null)
1598 throw new ArgumentNullException("function");
1599
1600 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>(function);
1601 }
1602
1603 /// <summary>
1604 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
1605 /// </summary>
1606 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1607 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1608 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1609 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
1610 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
1611 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
1612 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
1613 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
1614 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
1615 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
1616 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1617 /// <param name="function">Function to convert to an asynchronous function.</param>
1618 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
1619 /// <returns>Asynchronous function.</returns>
1620 /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
1621 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult> function, IScheduler scheduler)
1622 {
1623 if (function == null)
1624 throw new ArgumentNullException("function");
1625 if (scheduler == null)
1626 throw new ArgumentNullException("scheduler");
1627
1628 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>(function, scheduler);
1629 }
1630
1631 /// <summary>
1632 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
1633 /// </summary>
1634 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1635 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1636 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1637 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
1638 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
1639 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
1640 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
1641 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
1642 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
1643 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
1644 /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
1645 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1646 /// <param name="function">Function to convert to an asynchronous function.</param>
1647 /// <returns>Asynchronous function.</returns>
1648 /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
1649 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult> function)
1650 {
1651 if (function == null)
1652 throw new ArgumentNullException("function");
1653
1654 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>(function);
1655 }
1656
1657 /// <summary>
1658 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
1659 /// </summary>
1660 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1661 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1662 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1663 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
1664 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
1665 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
1666 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
1667 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
1668 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
1669 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
1670 /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
1671 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1672 /// <param name="function">Function to convert to an asynchronous function.</param>
1673 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
1674 /// <returns>Asynchronous function.</returns>
1675 /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
1676 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult> function, IScheduler scheduler)
1677 {
1678 if (function == null)
1679 throw new ArgumentNullException("function");
1680 if (scheduler == null)
1681 throw new ArgumentNullException("scheduler");
1682
1683 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>(function, scheduler);
1684 }
1685
1686 /// <summary>
1687 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
1688 /// </summary>
1689 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1690 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1691 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1692 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
1693 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
1694 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
1695 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
1696 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
1697 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
1698 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
1699 /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
1700 /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
1701 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1702 /// <param name="function">Function to convert to an asynchronous function.</param>
1703 /// <returns>Asynchronous function.</returns>
1704 /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
1705 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult> function)
1706 {
1707 if (function == null)
1708 throw new ArgumentNullException("function");
1709
1710 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>(function);
1711 }
1712
1713 /// <summary>
1714 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
1715 /// </summary>
1716 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1717 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1718 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1719 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
1720 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
1721 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
1722 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
1723 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
1724 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
1725 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
1726 /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
1727 /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
1728 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1729 /// <param name="function">Function to convert to an asynchronous function.</param>
1730 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
1731 /// <returns>Asynchronous function.</returns>
1732 /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
1733 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult> function, IScheduler scheduler)
1734 {
1735 if (function == null)
1736 throw new ArgumentNullException("function");
1737 if (scheduler == null)
1738 throw new ArgumentNullException("scheduler");
1739
1740 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>(function, scheduler);
1741 }
1742
1743 /// <summary>
1744 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
1745 /// </summary>
1746 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1747 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1748 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1749 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
1750 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
1751 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
1752 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
1753 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
1754 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
1755 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
1756 /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
1757 /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
1758 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
1759 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1760 /// <param name="function">Function to convert to an asynchronous function.</param>
1761 /// <returns>Asynchronous function.</returns>
1762 /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
1763 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult> function)
1764 {
1765 if (function == null)
1766 throw new ArgumentNullException("function");
1767
1768 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>(function);
1769 }
1770
1771 /// <summary>
1772 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
1773 /// </summary>
1774 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1775 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1776 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1777 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
1778 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
1779 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
1780 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
1781 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
1782 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
1783 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
1784 /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
1785 /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
1786 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
1787 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1788 /// <param name="function">Function to convert to an asynchronous function.</param>
1789 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
1790 /// <returns>Asynchronous function.</returns>
1791 /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
1792 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult> function, IScheduler scheduler)
1793 {
1794 if (function == null)
1795 throw new ArgumentNullException("function");
1796 if (scheduler == null)
1797 throw new ArgumentNullException("scheduler");
1798
1799 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>(function, scheduler);
1800 }
1801
1802 /// <summary>
1803 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
1804 /// </summary>
1805 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1806 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1807 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1808 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
1809 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
1810 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
1811 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
1812 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
1813 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
1814 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
1815 /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
1816 /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
1817 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
1818 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the function.</typeparam>
1819 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1820 /// <param name="function">Function to convert to an asynchronous function.</param>
1821 /// <returns>Asynchronous function.</returns>
1822 /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
1823 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult> function)
1824 {
1825 if (function == null)
1826 throw new ArgumentNullException("function");
1827
1828 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>(function);
1829 }
1830
1831 /// <summary>
1832 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
1833 /// </summary>
1834 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1835 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1836 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1837 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
1838 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
1839 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
1840 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
1841 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
1842 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
1843 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
1844 /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
1845 /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
1846 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
1847 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the function.</typeparam>
1848 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1849 /// <param name="function">Function to convert to an asynchronous function.</param>
1850 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
1851 /// <returns>Asynchronous function.</returns>
1852 /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
1853 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult> function, IScheduler scheduler)
1854 {
1855 if (function == null)
1856 throw new ArgumentNullException("function");
1857 if (scheduler == null)
1858 throw new ArgumentNullException("scheduler");
1859
1860 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>(function, scheduler);
1861 }
1862
1863 /// <summary>
1864 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
1865 /// </summary>
1866 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1867 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1868 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1869 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
1870 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
1871 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
1872 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
1873 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
1874 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
1875 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
1876 /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
1877 /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
1878 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
1879 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the function.</typeparam>
1880 /// <typeparam name="TArg15">The type of the fifteenth argument passed to the function.</typeparam>
1881 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1882 /// <param name="function">Function to convert to an asynchronous function.</param>
1883 /// <returns>Asynchronous function.</returns>
1884 /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
1885 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult> function)
1886 {
1887 if (function == null)
1888 throw new ArgumentNullException("function");
1889
1890 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult>(function);
1891 }
1892
1893 /// <summary>
1894 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
1895 /// </summary>
1896 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1897 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1898 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1899 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
1900 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
1901 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
1902 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
1903 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
1904 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
1905 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
1906 /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
1907 /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
1908 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
1909 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the function.</typeparam>
1910 /// <typeparam name="TArg15">The type of the fifteenth argument passed to the function.</typeparam>
1911 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1912 /// <param name="function">Function to convert to an asynchronous function.</param>
1913 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
1914 /// <returns>Asynchronous function.</returns>
1915 /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
1916 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult> function, IScheduler scheduler)
1917 {
1918 if (function == null)
1919 throw new ArgumentNullException("function");
1920 if (scheduler == null)
1921 throw new ArgumentNullException("scheduler");
1922
1923 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult>(function, scheduler);
1924 }
1925
1926 /// <summary>
1927 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
1928 /// </summary>
1929 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1930 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1931 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1932 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
1933 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
1934 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
1935 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
1936 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
1937 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
1938 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
1939 /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
1940 /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
1941 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
1942 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the function.</typeparam>
1943 /// <typeparam name="TArg15">The type of the fifteenth argument passed to the function.</typeparam>
1944 /// <typeparam name="TArg16">The type of the sixteenth argument passed to the function.</typeparam>
1945 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1946 /// <param name="function">Function to convert to an asynchronous function.</param>
1947 /// <returns>Asynchronous function.</returns>
1948 /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
1949 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult> function)
1950 {
1951 if (function == null)
1952 throw new ArgumentNullException("function");
1953
1954 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult>(function);
1955 }
1956
1957 /// <summary>
1958 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
1959 /// </summary>
1960 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
1961 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
1962 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
1963 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
1964 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
1965 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
1966 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
1967 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
1968 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
1969 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
1970 /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
1971 /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
1972 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
1973 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the function.</typeparam>
1974 /// <typeparam name="TArg15">The type of the fifteenth argument passed to the function.</typeparam>
1975 /// <typeparam name="TArg16">The type of the sixteenth argument passed to the function.</typeparam>
1976 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
1977 /// <param name="function">Function to convert to an asynchronous function.</param>
1978 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
1979 /// <returns>Asynchronous function.</returns>
1980 /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
1981 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult> function, IScheduler scheduler)
1982 {
1983 if (function == null)
1984 throw new ArgumentNullException("function");
1985 if (scheduler == null)
1986 throw new ArgumentNullException("scheduler");
1987
1988 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult>(function, scheduler);
1989 }
1990 #endif
1991
1992 #endregion
1993
1994 #region Action
1995
1996 /// <summary>
1997 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
1998 /// </summary>
1999 /// <param name="action">Action to convert to an asynchronous action.</param>
2000 /// <returns>Asynchronous action.</returns>
2001 /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
2002 public static Func<IObservable<Unit>> ToAsync(this Action action)
2003 {
2004 if (action == null)
2005 throw new ArgumentNullException("action");
2006
2007 return s_impl.ToAsync(action);
2008 }
2009
2010 /// <summary>
2011 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
2012 /// </summary>
2013 /// <param name="action">Action to convert to an asynchronous action.</param>
2014 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
2015 /// <returns>Asynchronous action.</returns>
2016 /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
2017 public static Func<IObservable<Unit>> ToAsync(this Action action, IScheduler scheduler)
2018 {
2019 if (action == null)
2020 throw new ArgumentNullException("action");
2021 if (scheduler == null)
2022 throw new ArgumentNullException("scheduler");
2023
2024 return s_impl.ToAsync(action, scheduler);
2025 }
2026
2027 /// <summary>
2028 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
2029 /// </summary>
2030 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2031 /// <param name="action">Action to convert to an asynchronous action.</param>
2032 /// <returns>Asynchronous action.</returns>
2033 /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
2034 public static Func<TArg1, IObservable<Unit>> ToAsync<TArg1>(this Action<TArg1> action)
2035 {
2036 if (action == null)
2037 throw new ArgumentNullException("action");
2038
2039 return s_impl.ToAsync<TArg1>(action);
2040 }
2041
2042 /// <summary>
2043 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
2044 /// </summary>
2045 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2046 /// <param name="action">Action to convert to an asynchronous action.</param>
2047 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
2048 /// <returns>Asynchronous action.</returns>
2049 /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
2050 public static Func<TArg1, IObservable<Unit>> ToAsync<TArg1>(this Action<TArg1> action, IScheduler scheduler)
2051 {
2052 if (action == null)
2053 throw new ArgumentNullException("action");
2054 if (scheduler == null)
2055 throw new ArgumentNullException("scheduler");
2056
2057 return s_impl.ToAsync<TArg1>(action, scheduler);
2058 }
2059
2060 /// <summary>
2061 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
2062 /// </summary>
2063 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2064 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2065 /// <param name="action">Action to convert to an asynchronous action.</param>
2066 /// <returns>Asynchronous action.</returns>
2067 /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
2068 public static Func<TArg1, TArg2, IObservable<Unit>> ToAsync<TArg1, TArg2>(this Action<TArg1, TArg2> action)
2069 {
2070 if (action == null)
2071 throw new ArgumentNullException("action");
2072
2073 return s_impl.ToAsync<TArg1, TArg2>(action);
2074 }
2075
2076 /// <summary>
2077 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
2078 /// </summary>
2079 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2080 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2081 /// <param name="action">Action to convert to an asynchronous action.</param>
2082 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
2083 /// <returns>Asynchronous action.</returns>
2084 /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
2085 public static Func<TArg1, TArg2, IObservable<Unit>> ToAsync<TArg1, TArg2>(this Action<TArg1, TArg2> action, IScheduler scheduler)
2086 {
2087 if (action == null)
2088 throw new ArgumentNullException("action");
2089 if (scheduler == null)
2090 throw new ArgumentNullException("scheduler");
2091
2092 return s_impl.ToAsync<TArg1, TArg2>(action, scheduler);
2093 }
2094
2095 /// <summary>
2096 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
2097 /// </summary>
2098 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2099 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2100 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2101 /// <param name="action">Action to convert to an asynchronous action.</param>
2102 /// <returns>Asynchronous action.</returns>
2103 /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
2104 public static Func<TArg1, TArg2, TArg3, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3>(this Action<TArg1, TArg2, TArg3> action)
2105 {
2106 if (action == null)
2107 throw new ArgumentNullException("action");
2108
2109 return s_impl.ToAsync<TArg1, TArg2, TArg3>(action);
2110 }
2111
2112 /// <summary>
2113 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
2114 /// </summary>
2115 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2116 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2117 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2118 /// <param name="action">Action to convert to an asynchronous action.</param>
2119 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
2120 /// <returns>Asynchronous action.</returns>
2121 /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
2122 public static Func<TArg1, TArg2, TArg3, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3>(this Action<TArg1, TArg2, TArg3> action, IScheduler scheduler)
2123 {
2124 if (action == null)
2125 throw new ArgumentNullException("action");
2126 if (scheduler == null)
2127 throw new ArgumentNullException("scheduler");
2128
2129 return s_impl.ToAsync<TArg1, TArg2, TArg3>(action, scheduler);
2130 }
2131
2132 /// <summary>
2133 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
2134 /// </summary>
2135 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2136 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2137 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2138 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
2139 /// <param name="action">Action to convert to an asynchronous action.</param>
2140 /// <returns>Asynchronous action.</returns>
2141 /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
2142 public static Func<TArg1, TArg2, TArg3, TArg4, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4>(this Action<TArg1, TArg2, TArg3, TArg4> action)
2143 {
2144 if (action == null)
2145 throw new ArgumentNullException("action");
2146
2147 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4>(action);
2148 }
2149
2150 /// <summary>
2151 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
2152 /// </summary>
2153 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2154 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2155 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2156 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
2157 /// <param name="action">Action to convert to an asynchronous action.</param>
2158 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
2159 /// <returns>Asynchronous action.</returns>
2160 /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
2161 public static Func<TArg1, TArg2, TArg3, TArg4, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4>(this Action<TArg1, TArg2, TArg3, TArg4> action, IScheduler scheduler)
2162 {
2163 if (action == null)
2164 throw new ArgumentNullException("action");
2165 if (scheduler == null)
2166 throw new ArgumentNullException("scheduler");
2167
2168 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4>(action, scheduler);
2169 }
2170
2171 #if !NO_LARGEARITY
2172
2173 /// <summary>
2174 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
2175 /// </summary>
2176 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2177 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2178 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2179 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
2180 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
2181 /// <param name="action">Action to convert to an asynchronous action.</param>
2182 /// <returns>Asynchronous action.</returns>
2183 /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
2184 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5> action)
2185 {
2186 if (action == null)
2187 throw new ArgumentNullException("action");
2188
2189 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5>(action);
2190 }
2191
2192 /// <summary>
2193 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
2194 /// </summary>
2195 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2196 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2197 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2198 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
2199 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
2200 /// <param name="action">Action to convert to an asynchronous action.</param>
2201 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
2202 /// <returns>Asynchronous action.</returns>
2203 /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
2204 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5> action, IScheduler scheduler)
2205 {
2206 if (action == null)
2207 throw new ArgumentNullException("action");
2208 if (scheduler == null)
2209 throw new ArgumentNullException("scheduler");
2210
2211 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5>(action, scheduler);
2212 }
2213
2214 /// <summary>
2215 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
2216 /// </summary>
2217 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2218 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2219 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2220 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
2221 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
2222 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
2223 /// <param name="action">Action to convert to an asynchronous action.</param>
2224 /// <returns>Asynchronous action.</returns>
2225 /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
2226 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6> action)
2227 {
2228 if (action == null)
2229 throw new ArgumentNullException("action");
2230
2231 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>(action);
2232 }
2233
2234 /// <summary>
2235 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
2236 /// </summary>
2237 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2238 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2239 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2240 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
2241 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
2242 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
2243 /// <param name="action">Action to convert to an asynchronous action.</param>
2244 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
2245 /// <returns>Asynchronous action.</returns>
2246 /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
2247 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6> action, IScheduler scheduler)
2248 {
2249 if (action == null)
2250 throw new ArgumentNullException("action");
2251 if (scheduler == null)
2252 throw new ArgumentNullException("scheduler");
2253
2254 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>(action, scheduler);
2255 }
2256
2257 /// <summary>
2258 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
2259 /// </summary>
2260 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2261 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2262 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2263 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
2264 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
2265 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
2266 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
2267 /// <param name="action">Action to convert to an asynchronous action.</param>
2268 /// <returns>Asynchronous action.</returns>
2269 /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
2270 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7> action)
2271 {
2272 if (action == null)
2273 throw new ArgumentNullException("action");
2274
2275 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>(action);
2276 }
2277
2278 /// <summary>
2279 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
2280 /// </summary>
2281 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2282 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2283 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2284 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
2285 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
2286 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
2287 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
2288 /// <param name="action">Action to convert to an asynchronous action.</param>
2289 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
2290 /// <returns>Asynchronous action.</returns>
2291 /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
2292 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7> action, IScheduler scheduler)
2293 {
2294 if (action == null)
2295 throw new ArgumentNullException("action");
2296 if (scheduler == null)
2297 throw new ArgumentNullException("scheduler");
2298
2299 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>(action, scheduler);
2300 }
2301
2302 /// <summary>
2303 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
2304 /// </summary>
2305 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2306 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2307 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2308 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
2309 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
2310 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
2311 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
2312 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
2313 /// <param name="action">Action to convert to an asynchronous action.</param>
2314 /// <returns>Asynchronous action.</returns>
2315 /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
2316 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8> action)
2317 {
2318 if (action == null)
2319 throw new ArgumentNullException("action");
2320
2321 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>(action);
2322 }
2323
2324 /// <summary>
2325 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
2326 /// </summary>
2327 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2328 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2329 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2330 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
2331 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
2332 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
2333 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
2334 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
2335 /// <param name="action">Action to convert to an asynchronous action.</param>
2336 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
2337 /// <returns>Asynchronous action.</returns>
2338 /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
2339 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8> action, IScheduler scheduler)
2340 {
2341 if (action == null)
2342 throw new ArgumentNullException("action");
2343 if (scheduler == null)
2344 throw new ArgumentNullException("scheduler");
2345
2346 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>(action, scheduler);
2347 }
2348
2349 /// <summary>
2350 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
2351 /// </summary>
2352 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2353 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2354 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2355 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
2356 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
2357 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
2358 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
2359 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
2360 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
2361 /// <param name="action">Action to convert to an asynchronous action.</param>
2362 /// <returns>Asynchronous action.</returns>
2363 /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
2364 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9> action)
2365 {
2366 if (action == null)
2367 throw new ArgumentNullException("action");
2368
2369 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>(action);
2370 }
2371
2372 /// <summary>
2373 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
2374 /// </summary>
2375 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2376 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2377 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2378 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
2379 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
2380 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
2381 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
2382 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
2383 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
2384 /// <param name="action">Action to convert to an asynchronous action.</param>
2385 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
2386 /// <returns>Asynchronous action.</returns>
2387 /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
2388 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9> action, IScheduler scheduler)
2389 {
2390 if (action == null)
2391 throw new ArgumentNullException("action");
2392 if (scheduler == null)
2393 throw new ArgumentNullException("scheduler");
2394
2395 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>(action, scheduler);
2396 }
2397
2398 /// <summary>
2399 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
2400 /// </summary>
2401 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2402 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2403 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2404 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
2405 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
2406 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
2407 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
2408 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
2409 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
2410 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
2411 /// <param name="action">Action to convert to an asynchronous action.</param>
2412 /// <returns>Asynchronous action.</returns>
2413 /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
2414 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10> action)
2415 {
2416 if (action == null)
2417 throw new ArgumentNullException("action");
2418
2419 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>(action);
2420 }
2421
2422 /// <summary>
2423 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
2424 /// </summary>
2425 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2426 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2427 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2428 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
2429 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
2430 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
2431 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
2432 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
2433 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
2434 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
2435 /// <param name="action">Action to convert to an asynchronous action.</param>
2436 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
2437 /// <returns>Asynchronous action.</returns>
2438 /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
2439 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10> action, IScheduler scheduler)
2440 {
2441 if (action == null)
2442 throw new ArgumentNullException("action");
2443 if (scheduler == null)
2444 throw new ArgumentNullException("scheduler");
2445
2446 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>(action, scheduler);
2447 }
2448
2449 /// <summary>
2450 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
2451 /// </summary>
2452 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2453 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2454 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2455 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
2456 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
2457 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
2458 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
2459 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
2460 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
2461 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
2462 /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
2463 /// <param name="action">Action to convert to an asynchronous action.</param>
2464 /// <returns>Asynchronous action.</returns>
2465 /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
2466 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11> action)
2467 {
2468 if (action == null)
2469 throw new ArgumentNullException("action");
2470
2471 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>(action);
2472 }
2473
2474 /// <summary>
2475 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
2476 /// </summary>
2477 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2478 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2479 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2480 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
2481 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
2482 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
2483 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
2484 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
2485 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
2486 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
2487 /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
2488 /// <param name="action">Action to convert to an asynchronous action.</param>
2489 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
2490 /// <returns>Asynchronous action.</returns>
2491 /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
2492 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11> action, IScheduler scheduler)
2493 {
2494 if (action == null)
2495 throw new ArgumentNullException("action");
2496 if (scheduler == null)
2497 throw new ArgumentNullException("scheduler");
2498
2499 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>(action, scheduler);
2500 }
2501
2502 /// <summary>
2503 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
2504 /// </summary>
2505 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2506 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2507 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2508 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
2509 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
2510 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
2511 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
2512 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
2513 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
2514 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
2515 /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
2516 /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
2517 /// <param name="action">Action to convert to an asynchronous action.</param>
2518 /// <returns>Asynchronous action.</returns>
2519 /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
2520 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12> action)
2521 {
2522 if (action == null)
2523 throw new ArgumentNullException("action");
2524
2525 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>(action);
2526 }
2527
2528 /// <summary>
2529 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
2530 /// </summary>
2531 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2532 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2533 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2534 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
2535 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
2536 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
2537 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
2538 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
2539 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
2540 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
2541 /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
2542 /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
2543 /// <param name="action">Action to convert to an asynchronous action.</param>
2544 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
2545 /// <returns>Asynchronous action.</returns>
2546 /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
2547 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12> action, IScheduler scheduler)
2548 {
2549 if (action == null)
2550 throw new ArgumentNullException("action");
2551 if (scheduler == null)
2552 throw new ArgumentNullException("scheduler");
2553
2554 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>(action, scheduler);
2555 }
2556
2557 /// <summary>
2558 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
2559 /// </summary>
2560 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2561 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2562 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2563 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
2564 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
2565 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
2566 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
2567 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
2568 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
2569 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
2570 /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
2571 /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
2572 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
2573 /// <param name="action">Action to convert to an asynchronous action.</param>
2574 /// <returns>Asynchronous action.</returns>
2575 /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
2576 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13> action)
2577 {
2578 if (action == null)
2579 throw new ArgumentNullException("action");
2580
2581 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>(action);
2582 }
2583
2584 /// <summary>
2585 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
2586 /// </summary>
2587 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2588 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2589 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2590 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
2591 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
2592 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
2593 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
2594 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
2595 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
2596 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
2597 /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
2598 /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
2599 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
2600 /// <param name="action">Action to convert to an asynchronous action.</param>
2601 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
2602 /// <returns>Asynchronous action.</returns>
2603 /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
2604 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13> action, IScheduler scheduler)
2605 {
2606 if (action == null)
2607 throw new ArgumentNullException("action");
2608 if (scheduler == null)
2609 throw new ArgumentNullException("scheduler");
2610
2611 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>(action, scheduler);
2612 }
2613
2614 /// <summary>
2615 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
2616 /// </summary>
2617 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2618 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2619 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2620 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
2621 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
2622 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
2623 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
2624 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
2625 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
2626 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
2627 /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
2628 /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
2629 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
2630 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the action.</typeparam>
2631 /// <param name="action">Action to convert to an asynchronous action.</param>
2632 /// <returns>Asynchronous action.</returns>
2633 /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
2634 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14> action)
2635 {
2636 if (action == null)
2637 throw new ArgumentNullException("action");
2638
2639 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>(action);
2640 }
2641
2642 /// <summary>
2643 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
2644 /// </summary>
2645 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2646 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2647 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2648 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
2649 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
2650 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
2651 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
2652 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
2653 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
2654 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
2655 /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
2656 /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
2657 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
2658 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the action.</typeparam>
2659 /// <param name="action">Action to convert to an asynchronous action.</param>
2660 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
2661 /// <returns>Asynchronous action.</returns>
2662 /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
2663 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14> action, IScheduler scheduler)
2664 {
2665 if (action == null)
2666 throw new ArgumentNullException("action");
2667 if (scheduler == null)
2668 throw new ArgumentNullException("scheduler");
2669
2670 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>(action, scheduler);
2671 }
2672
2673 /// <summary>
2674 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
2675 /// </summary>
2676 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2677 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2678 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2679 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
2680 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
2681 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
2682 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
2683 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
2684 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
2685 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
2686 /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
2687 /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
2688 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
2689 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the action.</typeparam>
2690 /// <typeparam name="TArg15">The type of the fifteenth argument passed to the action.</typeparam>
2691 /// <param name="action">Action to convert to an asynchronous action.</param>
2692 /// <returns>Asynchronous action.</returns>
2693 /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
2694 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15> action)
2695 {
2696 if (action == null)
2697 throw new ArgumentNullException("action");
2698
2699 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>(action);
2700 }
2701
2702 /// <summary>
2703 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
2704 /// </summary>
2705 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2706 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2707 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2708 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
2709 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
2710 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
2711 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
2712 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
2713 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
2714 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
2715 /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
2716 /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
2717 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
2718 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the action.</typeparam>
2719 /// <typeparam name="TArg15">The type of the fifteenth argument passed to the action.</typeparam>
2720 /// <param name="action">Action to convert to an asynchronous action.</param>
2721 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
2722 /// <returns>Asynchronous action.</returns>
2723 /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
2724 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15> action, IScheduler scheduler)
2725 {
2726 if (action == null)
2727 throw new ArgumentNullException("action");
2728 if (scheduler == null)
2729 throw new ArgumentNullException("scheduler");
2730
2731 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>(action, scheduler);
2732 }
2733
2734 /// <summary>
2735 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
2736 /// </summary>
2737 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2738 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2739 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2740 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
2741 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
2742 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
2743 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
2744 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
2745 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
2746 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
2747 /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
2748 /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
2749 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
2750 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the action.</typeparam>
2751 /// <typeparam name="TArg15">The type of the fifteenth argument passed to the action.</typeparam>
2752 /// <typeparam name="TArg16">The type of the sixteenth argument passed to the action.</typeparam>
2753 /// <param name="action">Action to convert to an asynchronous action.</param>
2754 /// <returns>Asynchronous action.</returns>
2755 /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
2756 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16> action)
2757 {
2758 if (action == null)
2759 throw new ArgumentNullException("action");
2760
2761 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16>(action);
2762 }
2763
2764 /// <summary>
2765 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
2766 /// </summary>
2767 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
2768 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
2769 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
2770 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
2771 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
2772 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
2773 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
2774 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
2775 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
2776 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
2777 /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
2778 /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
2779 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
2780 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the action.</typeparam>
2781 /// <typeparam name="TArg15">The type of the fifteenth argument passed to the action.</typeparam>
2782 /// <typeparam name="TArg16">The type of the sixteenth argument passed to the action.</typeparam>
2783 /// <param name="action">Action to convert to an asynchronous action.</param>
2784 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
2785 /// <returns>Asynchronous action.</returns>
2786 /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
2787 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16> action, IScheduler scheduler)
2788 {
2789 if (action == null)
2790 throw new ArgumentNullException("action");
2791 if (scheduler == null)
2792 throw new ArgumentNullException("scheduler");
2793
2794 return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16>(action, scheduler);
2795 }
2796 #endif
2797
2798 #endregion
2799
2800 #endregion
2801 }
2802 }