1
0

Observable.Async.cs 228 KB

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