Observable.Async.cs 215 KB

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