MinMax.Generated.cs 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // See the LICENSE file in the project root for more information.
  4. using System.Collections.Generic;
  5. using System.Threading;
  6. using System.Threading.Tasks;
  7. namespace System.Linq
  8. {
  9. public static partial class AsyncEnumerable
  10. {
  11. public static Task<int> MaxAsync(this IAsyncEnumerable<int> source, CancellationToken cancellationToken = default)
  12. {
  13. if (source == null)
  14. throw Error.ArgumentNull(nameof(source));
  15. return MaxCore(source, cancellationToken);
  16. }
  17. public static Task<int> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, int> selector, CancellationToken cancellationToken = default)
  18. {
  19. if (source == null)
  20. throw Error.ArgumentNull(nameof(source));
  21. if (selector == null)
  22. throw Error.ArgumentNull(nameof(selector));
  23. return MaxCore(source, selector, cancellationToken);
  24. }
  25. public static Task<int> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<int>> selector, CancellationToken cancellationToken = default)
  26. {
  27. if (source == null)
  28. throw Error.ArgumentNull(nameof(source));
  29. if (selector == null)
  30. throw Error.ArgumentNull(nameof(selector));
  31. return MaxCore(source, selector, cancellationToken);
  32. }
  33. #if !NO_DEEP_CANCELLATION
  34. public static Task<int> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<int>> selector, CancellationToken cancellationToken = default)
  35. {
  36. if (source == null)
  37. throw Error.ArgumentNull(nameof(source));
  38. if (selector == null)
  39. throw Error.ArgumentNull(nameof(selector));
  40. return MaxCore(source, selector, cancellationToken);
  41. }
  42. #endif
  43. public static Task<int?> MaxAsync(this IAsyncEnumerable<int?> source, CancellationToken cancellationToken = default)
  44. {
  45. if (source == null)
  46. throw Error.ArgumentNull(nameof(source));
  47. return MaxCore(source, cancellationToken);
  48. }
  49. public static Task<int?> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, int?> selector, CancellationToken cancellationToken = default)
  50. {
  51. if (source == null)
  52. throw Error.ArgumentNull(nameof(source));
  53. if (selector == null)
  54. throw Error.ArgumentNull(nameof(selector));
  55. return MaxCore(source, selector, cancellationToken);
  56. }
  57. public static Task<int?> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<int?>> selector, CancellationToken cancellationToken = default)
  58. {
  59. if (source == null)
  60. throw Error.ArgumentNull(nameof(source));
  61. if (selector == null)
  62. throw Error.ArgumentNull(nameof(selector));
  63. return MaxCore(source, selector, cancellationToken);
  64. }
  65. #if !NO_DEEP_CANCELLATION
  66. public static Task<int?> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<int?>> selector, CancellationToken cancellationToken = default)
  67. {
  68. if (source == null)
  69. throw Error.ArgumentNull(nameof(source));
  70. if (selector == null)
  71. throw Error.ArgumentNull(nameof(selector));
  72. return MaxCore(source, selector, cancellationToken);
  73. }
  74. #endif
  75. public static Task<long> MaxAsync(this IAsyncEnumerable<long> source, CancellationToken cancellationToken = default)
  76. {
  77. if (source == null)
  78. throw Error.ArgumentNull(nameof(source));
  79. return MaxCore(source, cancellationToken);
  80. }
  81. public static Task<long> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, long> selector, CancellationToken cancellationToken = default)
  82. {
  83. if (source == null)
  84. throw Error.ArgumentNull(nameof(source));
  85. if (selector == null)
  86. throw Error.ArgumentNull(nameof(selector));
  87. return MaxCore(source, selector, cancellationToken);
  88. }
  89. public static Task<long> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<long>> selector, CancellationToken cancellationToken = default)
  90. {
  91. if (source == null)
  92. throw Error.ArgumentNull(nameof(source));
  93. if (selector == null)
  94. throw Error.ArgumentNull(nameof(selector));
  95. return MaxCore(source, selector, cancellationToken);
  96. }
  97. #if !NO_DEEP_CANCELLATION
  98. public static Task<long> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<long>> selector, CancellationToken cancellationToken = default)
  99. {
  100. if (source == null)
  101. throw Error.ArgumentNull(nameof(source));
  102. if (selector == null)
  103. throw Error.ArgumentNull(nameof(selector));
  104. return MaxCore(source, selector, cancellationToken);
  105. }
  106. #endif
  107. public static Task<long?> MaxAsync(this IAsyncEnumerable<long?> source, CancellationToken cancellationToken = default)
  108. {
  109. if (source == null)
  110. throw Error.ArgumentNull(nameof(source));
  111. return MaxCore(source, cancellationToken);
  112. }
  113. public static Task<long?> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, long?> selector, CancellationToken cancellationToken = default)
  114. {
  115. if (source == null)
  116. throw Error.ArgumentNull(nameof(source));
  117. if (selector == null)
  118. throw Error.ArgumentNull(nameof(selector));
  119. return MaxCore(source, selector, cancellationToken);
  120. }
  121. public static Task<long?> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<long?>> selector, CancellationToken cancellationToken = default)
  122. {
  123. if (source == null)
  124. throw Error.ArgumentNull(nameof(source));
  125. if (selector == null)
  126. throw Error.ArgumentNull(nameof(selector));
  127. return MaxCore(source, selector, cancellationToken);
  128. }
  129. #if !NO_DEEP_CANCELLATION
  130. public static Task<long?> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<long?>> selector, CancellationToken cancellationToken = default)
  131. {
  132. if (source == null)
  133. throw Error.ArgumentNull(nameof(source));
  134. if (selector == null)
  135. throw Error.ArgumentNull(nameof(selector));
  136. return MaxCore(source, selector, cancellationToken);
  137. }
  138. #endif
  139. public static Task<float> MaxAsync(this IAsyncEnumerable<float> source, CancellationToken cancellationToken = default)
  140. {
  141. if (source == null)
  142. throw Error.ArgumentNull(nameof(source));
  143. return MaxCore(source, cancellationToken);
  144. }
  145. public static Task<float> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, float> selector, CancellationToken cancellationToken = default)
  146. {
  147. if (source == null)
  148. throw Error.ArgumentNull(nameof(source));
  149. if (selector == null)
  150. throw Error.ArgumentNull(nameof(selector));
  151. return MaxCore(source, selector, cancellationToken);
  152. }
  153. public static Task<float> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<float>> selector, CancellationToken cancellationToken = default)
  154. {
  155. if (source == null)
  156. throw Error.ArgumentNull(nameof(source));
  157. if (selector == null)
  158. throw Error.ArgumentNull(nameof(selector));
  159. return MaxCore(source, selector, cancellationToken);
  160. }
  161. #if !NO_DEEP_CANCELLATION
  162. public static Task<float> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<float>> selector, CancellationToken cancellationToken = default)
  163. {
  164. if (source == null)
  165. throw Error.ArgumentNull(nameof(source));
  166. if (selector == null)
  167. throw Error.ArgumentNull(nameof(selector));
  168. return MaxCore(source, selector, cancellationToken);
  169. }
  170. #endif
  171. public static Task<float?> MaxAsync(this IAsyncEnumerable<float?> source, CancellationToken cancellationToken = default)
  172. {
  173. if (source == null)
  174. throw Error.ArgumentNull(nameof(source));
  175. return MaxCore(source, cancellationToken);
  176. }
  177. public static Task<float?> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, float?> selector, CancellationToken cancellationToken = default)
  178. {
  179. if (source == null)
  180. throw Error.ArgumentNull(nameof(source));
  181. if (selector == null)
  182. throw Error.ArgumentNull(nameof(selector));
  183. return MaxCore(source, selector, cancellationToken);
  184. }
  185. public static Task<float?> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<float?>> selector, CancellationToken cancellationToken = default)
  186. {
  187. if (source == null)
  188. throw Error.ArgumentNull(nameof(source));
  189. if (selector == null)
  190. throw Error.ArgumentNull(nameof(selector));
  191. return MaxCore(source, selector, cancellationToken);
  192. }
  193. #if !NO_DEEP_CANCELLATION
  194. public static Task<float?> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<float?>> selector, CancellationToken cancellationToken = default)
  195. {
  196. if (source == null)
  197. throw Error.ArgumentNull(nameof(source));
  198. if (selector == null)
  199. throw Error.ArgumentNull(nameof(selector));
  200. return MaxCore(source, selector, cancellationToken);
  201. }
  202. #endif
  203. public static Task<double> MaxAsync(this IAsyncEnumerable<double> source, CancellationToken cancellationToken = default)
  204. {
  205. if (source == null)
  206. throw Error.ArgumentNull(nameof(source));
  207. return MaxCore(source, cancellationToken);
  208. }
  209. public static Task<double> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, double> selector, CancellationToken cancellationToken = default)
  210. {
  211. if (source == null)
  212. throw Error.ArgumentNull(nameof(source));
  213. if (selector == null)
  214. throw Error.ArgumentNull(nameof(selector));
  215. return MaxCore(source, selector, cancellationToken);
  216. }
  217. public static Task<double> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<double>> selector, CancellationToken cancellationToken = default)
  218. {
  219. if (source == null)
  220. throw Error.ArgumentNull(nameof(source));
  221. if (selector == null)
  222. throw Error.ArgumentNull(nameof(selector));
  223. return MaxCore(source, selector, cancellationToken);
  224. }
  225. #if !NO_DEEP_CANCELLATION
  226. public static Task<double> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<double>> selector, CancellationToken cancellationToken = default)
  227. {
  228. if (source == null)
  229. throw Error.ArgumentNull(nameof(source));
  230. if (selector == null)
  231. throw Error.ArgumentNull(nameof(selector));
  232. return MaxCore(source, selector, cancellationToken);
  233. }
  234. #endif
  235. public static Task<double?> MaxAsync(this IAsyncEnumerable<double?> source, CancellationToken cancellationToken = default)
  236. {
  237. if (source == null)
  238. throw Error.ArgumentNull(nameof(source));
  239. return MaxCore(source, cancellationToken);
  240. }
  241. public static Task<double?> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, double?> selector, CancellationToken cancellationToken = default)
  242. {
  243. if (source == null)
  244. throw Error.ArgumentNull(nameof(source));
  245. if (selector == null)
  246. throw Error.ArgumentNull(nameof(selector));
  247. return MaxCore(source, selector, cancellationToken);
  248. }
  249. public static Task<double?> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<double?>> selector, CancellationToken cancellationToken = default)
  250. {
  251. if (source == null)
  252. throw Error.ArgumentNull(nameof(source));
  253. if (selector == null)
  254. throw Error.ArgumentNull(nameof(selector));
  255. return MaxCore(source, selector, cancellationToken);
  256. }
  257. #if !NO_DEEP_CANCELLATION
  258. public static Task<double?> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<double?>> selector, CancellationToken cancellationToken = default)
  259. {
  260. if (source == null)
  261. throw Error.ArgumentNull(nameof(source));
  262. if (selector == null)
  263. throw Error.ArgumentNull(nameof(selector));
  264. return MaxCore(source, selector, cancellationToken);
  265. }
  266. #endif
  267. public static Task<decimal> MaxAsync(this IAsyncEnumerable<decimal> source, CancellationToken cancellationToken = default)
  268. {
  269. if (source == null)
  270. throw Error.ArgumentNull(nameof(source));
  271. return MaxCore(source, cancellationToken);
  272. }
  273. public static Task<decimal> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, decimal> selector, CancellationToken cancellationToken = default)
  274. {
  275. if (source == null)
  276. throw Error.ArgumentNull(nameof(source));
  277. if (selector == null)
  278. throw Error.ArgumentNull(nameof(selector));
  279. return MaxCore(source, selector, cancellationToken);
  280. }
  281. public static Task<decimal> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<decimal>> selector, CancellationToken cancellationToken = default)
  282. {
  283. if (source == null)
  284. throw Error.ArgumentNull(nameof(source));
  285. if (selector == null)
  286. throw Error.ArgumentNull(nameof(selector));
  287. return MaxCore(source, selector, cancellationToken);
  288. }
  289. #if !NO_DEEP_CANCELLATION
  290. public static Task<decimal> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<decimal>> selector, CancellationToken cancellationToken = default)
  291. {
  292. if (source == null)
  293. throw Error.ArgumentNull(nameof(source));
  294. if (selector == null)
  295. throw Error.ArgumentNull(nameof(selector));
  296. return MaxCore(source, selector, cancellationToken);
  297. }
  298. #endif
  299. public static Task<decimal?> MaxAsync(this IAsyncEnumerable<decimal?> source, CancellationToken cancellationToken = default)
  300. {
  301. if (source == null)
  302. throw Error.ArgumentNull(nameof(source));
  303. return MaxCore(source, cancellationToken);
  304. }
  305. public static Task<decimal?> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, decimal?> selector, CancellationToken cancellationToken = default)
  306. {
  307. if (source == null)
  308. throw Error.ArgumentNull(nameof(source));
  309. if (selector == null)
  310. throw Error.ArgumentNull(nameof(selector));
  311. return MaxCore(source, selector, cancellationToken);
  312. }
  313. public static Task<decimal?> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<decimal?>> selector, CancellationToken cancellationToken = default)
  314. {
  315. if (source == null)
  316. throw Error.ArgumentNull(nameof(source));
  317. if (selector == null)
  318. throw Error.ArgumentNull(nameof(selector));
  319. return MaxCore(source, selector, cancellationToken);
  320. }
  321. #if !NO_DEEP_CANCELLATION
  322. public static Task<decimal?> MaxAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<decimal?>> selector, CancellationToken cancellationToken = default)
  323. {
  324. if (source == null)
  325. throw Error.ArgumentNull(nameof(source));
  326. if (selector == null)
  327. throw Error.ArgumentNull(nameof(selector));
  328. return MaxCore(source, selector, cancellationToken);
  329. }
  330. #endif
  331. public static Task<int> MinAsync(this IAsyncEnumerable<int> source, CancellationToken cancellationToken = default)
  332. {
  333. if (source == null)
  334. throw Error.ArgumentNull(nameof(source));
  335. return MinCore(source, cancellationToken);
  336. }
  337. public static Task<int> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, int> selector, CancellationToken cancellationToken = default)
  338. {
  339. if (source == null)
  340. throw Error.ArgumentNull(nameof(source));
  341. if (selector == null)
  342. throw Error.ArgumentNull(nameof(selector));
  343. return MinCore(source, selector, cancellationToken);
  344. }
  345. public static Task<int> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<int>> selector, CancellationToken cancellationToken = default)
  346. {
  347. if (source == null)
  348. throw Error.ArgumentNull(nameof(source));
  349. if (selector == null)
  350. throw Error.ArgumentNull(nameof(selector));
  351. return MinCore(source, selector, cancellationToken);
  352. }
  353. #if !NO_DEEP_CANCELLATION
  354. public static Task<int> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<int>> selector, CancellationToken cancellationToken = default)
  355. {
  356. if (source == null)
  357. throw Error.ArgumentNull(nameof(source));
  358. if (selector == null)
  359. throw Error.ArgumentNull(nameof(selector));
  360. return MinCore(source, selector, cancellationToken);
  361. }
  362. #endif
  363. public static Task<int?> MinAsync(this IAsyncEnumerable<int?> source, CancellationToken cancellationToken = default)
  364. {
  365. if (source == null)
  366. throw Error.ArgumentNull(nameof(source));
  367. return MinCore(source, cancellationToken);
  368. }
  369. public static Task<int?> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, int?> selector, CancellationToken cancellationToken = default)
  370. {
  371. if (source == null)
  372. throw Error.ArgumentNull(nameof(source));
  373. if (selector == null)
  374. throw Error.ArgumentNull(nameof(selector));
  375. return MinCore(source, selector, cancellationToken);
  376. }
  377. public static Task<int?> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<int?>> selector, CancellationToken cancellationToken = default)
  378. {
  379. if (source == null)
  380. throw Error.ArgumentNull(nameof(source));
  381. if (selector == null)
  382. throw Error.ArgumentNull(nameof(selector));
  383. return MinCore(source, selector, cancellationToken);
  384. }
  385. #if !NO_DEEP_CANCELLATION
  386. public static Task<int?> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<int?>> selector, CancellationToken cancellationToken = default)
  387. {
  388. if (source == null)
  389. throw Error.ArgumentNull(nameof(source));
  390. if (selector == null)
  391. throw Error.ArgumentNull(nameof(selector));
  392. return MinCore(source, selector, cancellationToken);
  393. }
  394. #endif
  395. public static Task<long> MinAsync(this IAsyncEnumerable<long> source, CancellationToken cancellationToken = default)
  396. {
  397. if (source == null)
  398. throw Error.ArgumentNull(nameof(source));
  399. return MinCore(source, cancellationToken);
  400. }
  401. public static Task<long> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, long> selector, CancellationToken cancellationToken = default)
  402. {
  403. if (source == null)
  404. throw Error.ArgumentNull(nameof(source));
  405. if (selector == null)
  406. throw Error.ArgumentNull(nameof(selector));
  407. return MinCore(source, selector, cancellationToken);
  408. }
  409. public static Task<long> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<long>> selector, CancellationToken cancellationToken = default)
  410. {
  411. if (source == null)
  412. throw Error.ArgumentNull(nameof(source));
  413. if (selector == null)
  414. throw Error.ArgumentNull(nameof(selector));
  415. return MinCore(source, selector, cancellationToken);
  416. }
  417. #if !NO_DEEP_CANCELLATION
  418. public static Task<long> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<long>> selector, CancellationToken cancellationToken = default)
  419. {
  420. if (source == null)
  421. throw Error.ArgumentNull(nameof(source));
  422. if (selector == null)
  423. throw Error.ArgumentNull(nameof(selector));
  424. return MinCore(source, selector, cancellationToken);
  425. }
  426. #endif
  427. public static Task<long?> MinAsync(this IAsyncEnumerable<long?> source, CancellationToken cancellationToken = default)
  428. {
  429. if (source == null)
  430. throw Error.ArgumentNull(nameof(source));
  431. return MinCore(source, cancellationToken);
  432. }
  433. public static Task<long?> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, long?> selector, CancellationToken cancellationToken = default)
  434. {
  435. if (source == null)
  436. throw Error.ArgumentNull(nameof(source));
  437. if (selector == null)
  438. throw Error.ArgumentNull(nameof(selector));
  439. return MinCore(source, selector, cancellationToken);
  440. }
  441. public static Task<long?> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<long?>> selector, CancellationToken cancellationToken = default)
  442. {
  443. if (source == null)
  444. throw Error.ArgumentNull(nameof(source));
  445. if (selector == null)
  446. throw Error.ArgumentNull(nameof(selector));
  447. return MinCore(source, selector, cancellationToken);
  448. }
  449. #if !NO_DEEP_CANCELLATION
  450. public static Task<long?> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<long?>> selector, CancellationToken cancellationToken = default)
  451. {
  452. if (source == null)
  453. throw Error.ArgumentNull(nameof(source));
  454. if (selector == null)
  455. throw Error.ArgumentNull(nameof(selector));
  456. return MinCore(source, selector, cancellationToken);
  457. }
  458. #endif
  459. public static Task<float> MinAsync(this IAsyncEnumerable<float> source, CancellationToken cancellationToken = default)
  460. {
  461. if (source == null)
  462. throw Error.ArgumentNull(nameof(source));
  463. return MinCore(source, cancellationToken);
  464. }
  465. public static Task<float> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, float> selector, CancellationToken cancellationToken = default)
  466. {
  467. if (source == null)
  468. throw Error.ArgumentNull(nameof(source));
  469. if (selector == null)
  470. throw Error.ArgumentNull(nameof(selector));
  471. return MinCore(source, selector, cancellationToken);
  472. }
  473. public static Task<float> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<float>> selector, CancellationToken cancellationToken = default)
  474. {
  475. if (source == null)
  476. throw Error.ArgumentNull(nameof(source));
  477. if (selector == null)
  478. throw Error.ArgumentNull(nameof(selector));
  479. return MinCore(source, selector, cancellationToken);
  480. }
  481. #if !NO_DEEP_CANCELLATION
  482. public static Task<float> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<float>> selector, CancellationToken cancellationToken = default)
  483. {
  484. if (source == null)
  485. throw Error.ArgumentNull(nameof(source));
  486. if (selector == null)
  487. throw Error.ArgumentNull(nameof(selector));
  488. return MinCore(source, selector, cancellationToken);
  489. }
  490. #endif
  491. public static Task<float?> MinAsync(this IAsyncEnumerable<float?> source, CancellationToken cancellationToken = default)
  492. {
  493. if (source == null)
  494. throw Error.ArgumentNull(nameof(source));
  495. return MinCore(source, cancellationToken);
  496. }
  497. public static Task<float?> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, float?> selector, CancellationToken cancellationToken = default)
  498. {
  499. if (source == null)
  500. throw Error.ArgumentNull(nameof(source));
  501. if (selector == null)
  502. throw Error.ArgumentNull(nameof(selector));
  503. return MinCore(source, selector, cancellationToken);
  504. }
  505. public static Task<float?> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<float?>> selector, CancellationToken cancellationToken = default)
  506. {
  507. if (source == null)
  508. throw Error.ArgumentNull(nameof(source));
  509. if (selector == null)
  510. throw Error.ArgumentNull(nameof(selector));
  511. return MinCore(source, selector, cancellationToken);
  512. }
  513. #if !NO_DEEP_CANCELLATION
  514. public static Task<float?> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<float?>> selector, CancellationToken cancellationToken = default)
  515. {
  516. if (source == null)
  517. throw Error.ArgumentNull(nameof(source));
  518. if (selector == null)
  519. throw Error.ArgumentNull(nameof(selector));
  520. return MinCore(source, selector, cancellationToken);
  521. }
  522. #endif
  523. public static Task<double> MinAsync(this IAsyncEnumerable<double> source, CancellationToken cancellationToken = default)
  524. {
  525. if (source == null)
  526. throw Error.ArgumentNull(nameof(source));
  527. return MinCore(source, cancellationToken);
  528. }
  529. public static Task<double> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, double> selector, CancellationToken cancellationToken = default)
  530. {
  531. if (source == null)
  532. throw Error.ArgumentNull(nameof(source));
  533. if (selector == null)
  534. throw Error.ArgumentNull(nameof(selector));
  535. return MinCore(source, selector, cancellationToken);
  536. }
  537. public static Task<double> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<double>> selector, CancellationToken cancellationToken = default)
  538. {
  539. if (source == null)
  540. throw Error.ArgumentNull(nameof(source));
  541. if (selector == null)
  542. throw Error.ArgumentNull(nameof(selector));
  543. return MinCore(source, selector, cancellationToken);
  544. }
  545. #if !NO_DEEP_CANCELLATION
  546. public static Task<double> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<double>> selector, CancellationToken cancellationToken = default)
  547. {
  548. if (source == null)
  549. throw Error.ArgumentNull(nameof(source));
  550. if (selector == null)
  551. throw Error.ArgumentNull(nameof(selector));
  552. return MinCore(source, selector, cancellationToken);
  553. }
  554. #endif
  555. public static Task<double?> MinAsync(this IAsyncEnumerable<double?> source, CancellationToken cancellationToken = default)
  556. {
  557. if (source == null)
  558. throw Error.ArgumentNull(nameof(source));
  559. return MinCore(source, cancellationToken);
  560. }
  561. public static Task<double?> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, double?> selector, CancellationToken cancellationToken = default)
  562. {
  563. if (source == null)
  564. throw Error.ArgumentNull(nameof(source));
  565. if (selector == null)
  566. throw Error.ArgumentNull(nameof(selector));
  567. return MinCore(source, selector, cancellationToken);
  568. }
  569. public static Task<double?> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<double?>> selector, CancellationToken cancellationToken = default)
  570. {
  571. if (source == null)
  572. throw Error.ArgumentNull(nameof(source));
  573. if (selector == null)
  574. throw Error.ArgumentNull(nameof(selector));
  575. return MinCore(source, selector, cancellationToken);
  576. }
  577. #if !NO_DEEP_CANCELLATION
  578. public static Task<double?> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<double?>> selector, CancellationToken cancellationToken = default)
  579. {
  580. if (source == null)
  581. throw Error.ArgumentNull(nameof(source));
  582. if (selector == null)
  583. throw Error.ArgumentNull(nameof(selector));
  584. return MinCore(source, selector, cancellationToken);
  585. }
  586. #endif
  587. public static Task<decimal> MinAsync(this IAsyncEnumerable<decimal> source, CancellationToken cancellationToken = default)
  588. {
  589. if (source == null)
  590. throw Error.ArgumentNull(nameof(source));
  591. return MinCore(source, cancellationToken);
  592. }
  593. public static Task<decimal> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, decimal> selector, CancellationToken cancellationToken = default)
  594. {
  595. if (source == null)
  596. throw Error.ArgumentNull(nameof(source));
  597. if (selector == null)
  598. throw Error.ArgumentNull(nameof(selector));
  599. return MinCore(source, selector, cancellationToken);
  600. }
  601. public static Task<decimal> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<decimal>> selector, CancellationToken cancellationToken = default)
  602. {
  603. if (source == null)
  604. throw Error.ArgumentNull(nameof(source));
  605. if (selector == null)
  606. throw Error.ArgumentNull(nameof(selector));
  607. return MinCore(source, selector, cancellationToken);
  608. }
  609. #if !NO_DEEP_CANCELLATION
  610. public static Task<decimal> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<decimal>> selector, CancellationToken cancellationToken = default)
  611. {
  612. if (source == null)
  613. throw Error.ArgumentNull(nameof(source));
  614. if (selector == null)
  615. throw Error.ArgumentNull(nameof(selector));
  616. return MinCore(source, selector, cancellationToken);
  617. }
  618. #endif
  619. public static Task<decimal?> MinAsync(this IAsyncEnumerable<decimal?> source, CancellationToken cancellationToken = default)
  620. {
  621. if (source == null)
  622. throw Error.ArgumentNull(nameof(source));
  623. return MinCore(source, cancellationToken);
  624. }
  625. public static Task<decimal?> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, decimal?> selector, CancellationToken cancellationToken = default)
  626. {
  627. if (source == null)
  628. throw Error.ArgumentNull(nameof(source));
  629. if (selector == null)
  630. throw Error.ArgumentNull(nameof(selector));
  631. return MinCore(source, selector, cancellationToken);
  632. }
  633. public static Task<decimal?> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<decimal?>> selector, CancellationToken cancellationToken = default)
  634. {
  635. if (source == null)
  636. throw Error.ArgumentNull(nameof(source));
  637. if (selector == null)
  638. throw Error.ArgumentNull(nameof(selector));
  639. return MinCore(source, selector, cancellationToken);
  640. }
  641. #if !NO_DEEP_CANCELLATION
  642. public static Task<decimal?> MinAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<decimal?>> selector, CancellationToken cancellationToken = default)
  643. {
  644. if (source == null)
  645. throw Error.ArgumentNull(nameof(source));
  646. if (selector == null)
  647. throw Error.ArgumentNull(nameof(selector));
  648. return MinCore(source, selector, cancellationToken);
  649. }
  650. #endif
  651. }
  652. }