Observable.Async.cs 223 KB

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