| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556 |
- // Licensed to the .NET Foundation under one or more agreements.
- // The .NET Foundation licenses this file to you under the Apache 2.0 License.
- // See the LICENSE file in the project root for more information.
- using System.Collections.Generic;
- using System.Linq;
- namespace System.Reactive.Linq
- {
- public static partial class Observable
- {
- #region + Aggregate +
- /// <summary>
- /// Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.
- /// For aggregation behavior with incremental intermediate results, see <see cref="Observable.Scan<TSource, Accumulate>"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TAccumulate">The type of the result of the aggregation.</typeparam>
- /// <param name="source">An observable sequence to aggregate over.</param>
- /// <param name="seed">The initial accumulator value.</param>
- /// <param name="accumulator">An accumulator function to be invoked on each element.</param>
- /// <returns>An observable sequence containing a single element with the final accumulator value.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="accumulator"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<TAccumulate> Aggregate<TSource, TAccumulate>(this IObservable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (accumulator == null)
- throw new ArgumentNullException(nameof(accumulator));
- return s_impl.Aggregate<TSource, TAccumulate>(source, seed, accumulator);
- }
- /// <summary>
- /// Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value,
- /// and the specified result selector function is used to select the result value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TAccumulate">The type of the accumulator value.</typeparam>
- /// <typeparam name="TResult">The type of the resulting value.</typeparam>
- /// <param name="source">An observable sequence to aggregate over.</param>
- /// <param name="seed">The initial accumulator value.</param>
- /// <param name="accumulator">An accumulator function to be invoked on each element.</param>
- /// <param name="resultSelector">A function to transform the final accumulator value into the result value.</param>
- /// <returns>An observable sequence containing a single element with the final accumulator value.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="accumulator"/> or <paramref name="resultSelector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<TResult> Aggregate<TSource, TAccumulate, TResult>(this IObservable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator, Func<TAccumulate, TResult> resultSelector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (accumulator == null)
- throw new ArgumentNullException(nameof(accumulator));
- if (resultSelector == null)
- throw new ArgumentNullException(nameof(resultSelector));
- return s_impl.Aggregate<TSource, TAccumulate, TResult>(source, seed, accumulator, resultSelector);
- }
- /// <summary>
- /// Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence.
- /// For aggregation behavior with incremental intermediate results, see <see cref="Observable.Scan<TSource>"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence and the result of the aggregation.</typeparam>
- /// <param name="source">An observable sequence to aggregate over.</param>
- /// <param name="accumulator">An accumulator function to be invoked on each element.</param>
- /// <returns>An observable sequence containing a single element with the final accumulator value.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="accumulator"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<TSource> Aggregate<TSource>(this IObservable<TSource> source, Func<TSource, TSource, TSource> accumulator)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (accumulator == null)
- throw new ArgumentNullException(nameof(accumulator));
- return s_impl.Aggregate<TSource>(source, accumulator);
- }
- #endregion
- #region + All +
- /// <summary>
- /// Determines whether all elements of an observable sequence satisfy a condition.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence whose elements to apply the predicate to.</param>
- /// <param name="predicate">A function to test each element for a condition.</param>
- /// <returns>An observable sequence containing a single element determining whether all elements in the source sequence pass the test in the specified predicate.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<bool> All<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (predicate == null)
- throw new ArgumentNullException(nameof(predicate));
- return s_impl.All<TSource>(source, predicate);
- }
- #endregion
- #region + Any +
- /// <summary>
- /// Determines whether an observable sequence contains any elements.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to check for non-emptiness.</param>
- /// <returns>An observable sequence containing a single element determining whether the source sequence contains any elements.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<bool> Any<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Any<TSource>(source);
- }
- /// <summary>
- /// Determines whether any element of an observable sequence satisfies a condition.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence whose elements to apply the predicate to.</param>
- /// <param name="predicate">A function to test each element for a condition.</param>
- /// <returns>An observable sequence containing a single element determining whether any elements in the source sequence pass the test in the specified predicate.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<bool> Any<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (predicate == null)
- throw new ArgumentNullException(nameof(predicate));
- return s_impl.Any<TSource>(source, predicate);
- }
- #endregion
- #region + Average +
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Double" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Double" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double> Average(this IObservable<double> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Average(source);
- }
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Single" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Single" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float> Average(this IObservable<float> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Average(source);
- }
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Decimal" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Decimal" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal> Average(this IObservable<decimal> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Average(source);
- }
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Int32" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Int32" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double> Average(this IObservable<int> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Average(source);
- }
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Int64" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Int64" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double> Average(this IObservable<long> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Average(source);
- }
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Double" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Double" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double?> Average(this IObservable<double?> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Average(source);
- }
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Single" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Single" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float?> Average(this IObservable<float?> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Average(source);
- }
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Decimal" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Decimal" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal?> Average(this IObservable<decimal?> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Average(source);
- }
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Int32" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Int32" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- public static IObservable<double?> Average(this IObservable<int?> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Average(source);
- }
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Int64" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Int64" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double?> Average(this IObservable<long?> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Average(source);
- }
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Decimal" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal> Average<TSource>(this IObservable<TSource> source, Func<TSource, decimal> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Average<TSource>(source, selector);
- }
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Double" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double> Average<TSource>(this IObservable<TSource> source, Func<TSource, double> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Average<TSource>(source, selector);
- }
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Single" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float> Average<TSource>(this IObservable<TSource> source, Func<TSource, float> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Average<TSource>(source, selector);
- }
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Int32" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double> Average<TSource>(this IObservable<TSource> source, Func<TSource, int> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Average<TSource>(source, selector);
- }
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Int64" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double> Average<TSource>(this IObservable<TSource> source, Func<TSource, long> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Average<TSource>(source, selector);
- }
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Decimal" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal?> Average<TSource>(this IObservable<TSource> source, Func<TSource, decimal?> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Average<TSource>(source, selector);
- }
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Double" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double?> Average<TSource>(this IObservable<TSource> source, Func<TSource, double?> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Average<TSource>(source, selector);
- }
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Single" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float?> Average<TSource>(this IObservable<TSource> source, Func<TSource, float?> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Average<TSource>(source, selector);
- }
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Int32" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double?> Average<TSource>(this IObservable<TSource> source, Func<TSource, int?> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Average<TSource>(source, selector);
- }
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Int64" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double?> Average<TSource>(this IObservable<TSource> source, Func<TSource, long?> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Average<TSource>(source, selector);
- }
- #endregion
- #region + Contains +
- /// <summary>
- /// Determines whether an observable sequence contains a specified element by using the default equality comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence in which to locate a value.</param>
- /// <param name="value">The value to locate in the source sequence.</param>
- /// <returns>An observable sequence containing a single element determining whether the source sequence contains an element that has the specified value.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<bool> Contains<TSource>(this IObservable<TSource> source, TSource value)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Contains<TSource>(source, value);
- }
- /// <summary>
- /// Determines whether an observable sequence contains a specified element by using a specified System.Collections.Generic.IEqualityComparer<T>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence in which to locate a value.</param>
- /// <param name="value">The value to locate in the source sequence.</param>
- /// <param name="comparer">An equality comparer to compare elements.</param>
- /// <returns>An observable sequence containing a single element determining whether the source sequence contains an element that has the specified value.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<bool> Contains<TSource>(this IObservable<TSource> source, TSource value, IEqualityComparer<TSource> comparer)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (comparer == null)
- throw new ArgumentNullException(nameof(comparer));
- return s_impl.Contains<TSource>(source, value, comparer);
- }
- #endregion
- #region + Count +
- /// <summary>
- /// Returns an observable sequence containing an <see cref="T:System.Int32" /> that represents the total number of elements in an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence that contains elements to be counted.</param>
- /// <returns>An observable sequence containing a single element with the number of elements in the input sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The number of elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int> Count<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Count<TSource>(source);
- }
- /// <summary>
- /// Returns an observable sequence containing an <see cref="T:System.Int32" /> that represents how many elements in the specified observable sequence satisfy a condition.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence that contains elements to be counted.</param>
- /// <param name="predicate">A function to test each element for a condition.</param>
- /// <returns>An observable sequence containing a single element with a number that represents how many elements in the input sequence satisfy the condition in the predicate function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int> Count<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (predicate == null)
- throw new ArgumentNullException(nameof(predicate));
- return s_impl.Count<TSource>(source, predicate);
- }
- #endregion
- #region + ElementAt +
- /// <summary>
- /// Returns the element at a specified index in a sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Observable sequence to return the element from.</param>
- /// <param name="index">The zero-based index of the element to retrieve.</param>
- /// <returns>An observable sequence that produces the element at the specified position in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="index"/> is less than zero.</exception>
- /// <exception cref="ArgumentOutOfRangeException">(Asynchronous) <paramref name="index"/> is greater than or equal to the number of elements in the source sequence.</exception>
- public static IObservable<TSource> ElementAt<TSource>(this IObservable<TSource> source, int index)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (index < 0)
- throw new ArgumentOutOfRangeException(nameof(index));
- return s_impl.ElementAt<TSource>(source, index);
- }
- #endregion
- #region + ElementAtOrDefault +
- /// <summary>
- /// Returns the element at a specified index in a sequence or a default value if the index is out of range.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Observable sequence to return the element from.</param>
- /// <param name="index">The zero-based index of the element to retrieve.</param>
- /// <returns>An observable sequence that produces the element at the specified position in the source sequence, or a default value if the index is outside the bounds of the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="index"/> is less than zero.</exception>
- public static IObservable<TSource> ElementAtOrDefault<TSource>(this IObservable<TSource> source, int index)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (index < 0)
- throw new ArgumentOutOfRangeException(nameof(index));
- return s_impl.ElementAtOrDefault<TSource>(source, index);
- }
- #endregion
- #region + FirstAsync +
- /// <summary>
- /// Returns the first element of an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>Sequence containing the first element in the observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- public static IObservable<TSource> FirstAsync<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.FirstAsync<TSource>(source);
- }
- /// <summary>
- /// Returns the first element of an observable sequence that satisfies the condition in the predicate.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
- /// <returns>Sequence containing the first element in the observable sequence that satisfies the condition in the predicate.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) No element satisfies the condition in the predicate. -or- The source sequence is empty.</exception>
- public static IObservable<TSource> FirstAsync<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (predicate == null)
- throw new ArgumentNullException(nameof(predicate));
- return s_impl.FirstAsync<TSource>(source, predicate);
- }
- #endregion
- #region + FirstOrDefaultAsync +
- /// <summary>
- /// Returns the first element of an observable sequence, or a default value if no such element exists.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>Sequence containing the first element in the observable sequence, or a default value if no such element exists.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TSource> FirstOrDefaultAsync<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.FirstOrDefaultAsync<TSource>(source);
- }
- /// <summary>
- /// Returns the first element of an observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
- /// <returns>Sequence containing the first element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- public static IObservable<TSource> FirstOrDefaultAsync<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (predicate == null)
- throw new ArgumentNullException(nameof(predicate));
- return s_impl.FirstOrDefaultAsync<TSource>(source, predicate);
- }
- #endregion
- #region + IsEmpty +
- /// <summary>
- /// Determines whether an observable sequence is empty.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to check for emptiness.</param>
- /// <returns>An observable sequence containing a single element determining whether the source sequence is empty.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<bool> IsEmpty<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.IsEmpty<TSource>(source);
- }
- #endregion
- #region + LastAsync +
- /// <summary>
- /// Returns the last element of an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>Sequence containing the last element in the observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- public static IObservable<TSource> LastAsync<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.LastAsync<TSource>(source);
- }
- /// <summary>
- /// Returns the last element of an observable sequence that satisfies the condition in the predicate.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
- /// <returns>Sequence containing the last element in the observable sequence that satisfies the condition in the predicate.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) No element satisfies the condition in the predicate. -or- The source sequence is empty.</exception>
- public static IObservable<TSource> LastAsync<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (predicate == null)
- throw new ArgumentNullException(nameof(predicate));
- return s_impl.LastAsync<TSource>(source, predicate);
- }
- #endregion
- #region + LastOrDefaultAsync +
- /// <summary>
- /// Returns the last element of an observable sequence, or a default value if no such element exists.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>Sequence containing the last element in the observable sequence, or a default value if no such element exists.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TSource> LastOrDefaultAsync<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.LastOrDefaultAsync<TSource>(source);
- }
- /// <summary>
- /// Returns the last element of an observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
- /// <returns>Sequence containing the last element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- public static IObservable<TSource> LastOrDefaultAsync<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (predicate == null)
- throw new ArgumentNullException(nameof(predicate));
- return s_impl.LastOrDefaultAsync<TSource>(source, predicate);
- }
- #endregion
- #region + LongCount +
- /// <summary>
- /// Returns an observable sequence containing an <see cref="T:System.Int64" /> that represents the total number of elements in an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence that contains elements to be counted.</param>
- /// <returns>An observable sequence containing a single element with the number of elements in the input sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The number of elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long> LongCount<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.LongCount<TSource>(source);
- }
- /// <summary>
- /// Returns an observable sequence containing an <see cref="T:System.Int64" /> that represents how many elements in the specified observable sequence satisfy a condition.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence that contains elements to be counted.</param>
- /// <param name="predicate">A function to test each element for a condition.</param>
- /// <returns>An observable sequence containing a single element with a number that represents how many elements in the input sequence satisfy the condition in the predicate function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long> LongCount<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (predicate == null)
- throw new ArgumentNullException(nameof(predicate));
- return s_impl.LongCount<TSource>(source, predicate);
- }
- #endregion
- #region + Max +
- /// <summary>
- /// Returns the maximum element in an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to determine the maximum element of.</param>
- /// <returns>An observable sequence containing a single element with the maximum element in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<TSource> Max<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Max<TSource>(source);
- }
- /// <summary>
- /// Returns the maximum value in an observable sequence according to the specified comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to determine the maximum element of.</param>
- /// <param name="comparer">Comparer used to compare elements.</param>
- /// <returns>An observable sequence containing a single element with the maximum element in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<TSource> Max<TSource>(this IObservable<TSource> source, IComparer<TSource> comparer)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (comparer == null)
- throw new ArgumentNullException(nameof(comparer));
- return s_impl.Max<TSource>(source, comparer);
- }
- /// <summary>
- /// Returns the maximum value in an observable sequence of <see cref="T:System.Double" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Double" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double> Max(this IObservable<double> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Max(source);
- }
- /// <summary>
- /// Returns the maximum value in an observable sequence of <see cref="T:System.Single" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Single" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float> Max(this IObservable<float> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Max(source);
- }
- /// <summary>
- /// Returns the maximum value in an observable sequence of <see cref="T:System.Decimal" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Decimal" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal> Max(this IObservable<decimal> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Max(source);
- }
- /// <summary>
- /// Returns the maximum value in an observable sequence of <see cref="T:System.Int32" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Int32" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int> Max(this IObservable<int> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Max(source);
- }
- /// <summary>
- /// Returns the maximum value in an observable sequence of <see cref="T:System.Int64" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Int64" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long> Max(this IObservable<long> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Max(source);
- }
- /// <summary>
- /// Returns the maximum value in an observable sequence of nullable <see cref="T:System.Double" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Double" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double?> Max(this IObservable<double?> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Max(source);
- }
- /// <summary>
- /// Returns the maximum value in an observable sequence of nullable <see cref="T:System.Single" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Single" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float?> Max(this IObservable<float?> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Max(source);
- }
- /// <summary>
- /// Returns the maximum value in an observable sequence of nullable <see cref="T:System.Decimal" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Decimal" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal?> Max(this IObservable<decimal?> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Max(source);
- }
- /// <summary>
- /// Returns the maximum value in an observable sequence of nullable <see cref="T:System.Int32" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Int32" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int?> Max(this IObservable<int?> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Max(source);
- }
- /// <summary>
- /// Returns the maximum value in an observable sequence of nullable <see cref="T:System.Int64" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Int64" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long?> Max(this IObservable<long?> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Max(source);
- }
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the objects derived from the elements in the source sequence to determine the maximum of.</typeparam>
- /// <param name="source">An observable sequence to determine the mimimum element of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value that corresponds to the maximum element in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<TResult> Max<TSource, TResult>(this IObservable<TSource> source, Func<TSource, TResult> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Max<TSource, TResult>(source, selector);
- }
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum value according to the specified comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the objects derived from the elements in the source sequence to determine the maximum of.</typeparam>
- /// <param name="source">An observable sequence to determine the mimimum element of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <param name="comparer">Comparer used to compare elements.</param>
- /// <returns>An observable sequence containing a single element with the value that corresponds to the maximum element in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<TResult> Max<TSource, TResult>(this IObservable<TSource> source, Func<TSource, TResult> selector, IComparer<TResult> comparer)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- if (comparer == null)
- throw new ArgumentNullException(nameof(comparer));
- return s_impl.Max<TSource, TResult>(source, selector, comparer);
- }
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Double" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Double" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double> Max<TSource>(this IObservable<TSource> source, Func<TSource, double> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Max<TSource>(source, selector);
- }
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Single" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Single" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float> Max<TSource>(this IObservable<TSource> source, Func<TSource, float> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Max<TSource>(source, selector);
- }
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Decimal" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Decimal" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal> Max<TSource>(this IObservable<TSource> source, Func<TSource, decimal> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Max<TSource>(source, selector);
- }
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Int32" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Int32" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int> Max<TSource>(this IObservable<TSource> source, Func<TSource, int> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Max<TSource>(source, selector);
- }
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Int64" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Int64" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long> Max<TSource>(this IObservable<TSource> source, Func<TSource, long> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Max<TSource>(source, selector);
- }
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Double" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable<System.Double>" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double?> Max<TSource>(this IObservable<TSource> source, Func<TSource, double?> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Max<TSource>(source, selector);
- }
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Single" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable<System.Single>" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float?> Max<TSource>(this IObservable<TSource> source, Func<TSource, float?> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Max<TSource>(source, selector);
- }
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Decimal" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable<System.Decimal>" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal?> Max<TSource>(this IObservable<TSource> source, Func<TSource, decimal?> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Max<TSource>(source, selector);
- }
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Int32" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable<System.Int32>" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int?> Max<TSource>(this IObservable<TSource> source, Func<TSource, int?> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Max<TSource>(source, selector);
- }
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Int64" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable<System.Int64>" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long?> Max<TSource>(this IObservable<TSource> source, Func<TSource, long?> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Max<TSource>(source, selector);
- }
- #endregion
- #region + MaxBy +
- /// <summary>
- /// Returns the elements in an observable sequence with the maximum key value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to get the maximum elements for.</param>
- /// <param name="keySelector">Key selector function.</param>
- /// <returns>An observable sequence containing a list of zero or more elements that have a maximum key value.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<IList<TSource>> MaxBy<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (keySelector == null)
- throw new ArgumentNullException(nameof(keySelector));
- return s_impl.MaxBy<TSource, TKey>(source, keySelector);
- }
- /// <summary>
- /// Returns the elements in an observable sequence with the maximum key value according to the specified comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to get the maximum elements for.</param>
- /// <param name="keySelector">Key selector function.</param>
- /// <param name="comparer">Comparer used to compare key values.</param>
- /// <returns>An observable sequence containing a list of zero or more elements that have a maximum key value.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<IList<TSource>> MaxBy<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (keySelector == null)
- throw new ArgumentNullException(nameof(keySelector));
- if (comparer == null)
- throw new ArgumentNullException(nameof(comparer));
- return s_impl.MaxBy<TSource, TKey>(source, keySelector, comparer);
- }
- #endregion
- #region + Min +
- /// <summary>
- /// Returns the minimum element in an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to determine the mimimum element of.</param>
- /// <returns>An observable sequence containing a single element with the minimum element in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<TSource> Min<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Min<TSource>(source);
- }
- /// <summary>
- /// Returns the minimum element in an observable sequence according to the specified comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to determine the mimimum element of.</param>
- /// <param name="comparer">Comparer used to compare elements.</param>
- /// <returns>An observable sequence containing a single element with the minimum element in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<TSource> Min<TSource>(this IObservable<TSource> source, IComparer<TSource> comparer)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (comparer == null)
- throw new ArgumentNullException(nameof(comparer));
- return s_impl.Min<TSource>(source, comparer);
- }
- /// <summary>
- /// Returns the minimum value in an observable sequence of <see cref="T:System.Double" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Double" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double> Min(this IObservable<double> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Min(source);
- }
- /// <summary>
- /// Returns the minimum value in an observable sequence of <see cref="T:System.Single" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Single" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float> Min(this IObservable<float> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Min(source);
- }
- /// <summary>
- /// Returns the minimum value in an observable sequence of <see cref="T:System.Decimal" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Decimal" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal> Min(this IObservable<decimal> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Min(source);
- }
- /// <summary>
- /// Returns the minimum value in an observable sequence of <see cref="T:System.Int32" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Int32" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int> Min(this IObservable<int> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Min(source);
- }
- /// <summary>
- /// Returns the minimum value in an observable sequence of <see cref="T:System.Int64" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Int64" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long> Min(this IObservable<long> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Min(source);
- }
- /// <summary>
- /// Returns the minimum value in an observable sequence of nullable <see cref="T:System.Double" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Double" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double?> Min(this IObservable<double?> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Min(source);
- }
- /// <summary>
- /// Returns the minimum value in an observable sequence of nullable <see cref="T:System.Single" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Single" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float?> Min(this IObservable<float?> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Min(source);
- }
- /// <summary>
- /// Returns the minimum value in an observable sequence of nullable <see cref="T:System.Decimal" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Decimal" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal?> Min(this IObservable<decimal?> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Min(source);
- }
- /// <summary>
- /// Returns the minimum value in an observable sequence of nullable <see cref="T:System.Int32" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Int32" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int?> Min(this IObservable<int?> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Min(source);
- }
- /// <summary>
- /// Returns the minimum value in an observable sequence of nullable <see cref="T:System.Int64" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Int64" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long?> Min(this IObservable<long?> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Min(source);
- }
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the objects derived from the elements in the source sequence to determine the minimum of.</typeparam>
- /// <param name="source">An observable sequence to determine the mimimum element of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value that corresponds to the minimum element in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<TResult> Min<TSource, TResult>(this IObservable<TSource> source, Func<TSource, TResult> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Min<TSource, TResult>(source, selector);
- }
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum value according to the specified comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the objects derived from the elements in the source sequence to determine the minimum of.</typeparam>
- /// <param name="source">An observable sequence to determine the mimimum element of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <param name="comparer">Comparer used to compare elements.</param>
- /// <returns>An observable sequence containing a single element with the value that corresponds to the minimum element in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<TResult> Min<TSource, TResult>(this IObservable<TSource> source, Func<TSource, TResult> selector, IComparer<TResult> comparer)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- if (comparer == null)
- throw new ArgumentNullException(nameof(comparer));
- return s_impl.Min<TSource, TResult>(source, selector, comparer);
- }
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Double" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Double" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double> Min<TSource>(this IObservable<TSource> source, Func<TSource, double> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Min<TSource>(source, selector);
- }
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Single" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Single" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float> Min<TSource>(this IObservable<TSource> source, Func<TSource, float> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Min<TSource>(source, selector);
- }
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Decimal" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Decimal" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal> Min<TSource>(this IObservable<TSource> source, Func<TSource, decimal> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Min<TSource>(source, selector);
- }
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Int32" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Int32" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int> Min<TSource>(this IObservable<TSource> source, Func<TSource, int> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Min<TSource>(source, selector);
- }
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Int64" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Int64" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long> Min<TSource>(this IObservable<TSource> source, Func<TSource, long> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Min<TSource>(source, selector);
- }
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Double" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable<System.Double>" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double?> Min<TSource>(this IObservable<TSource> source, Func<TSource, double?> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Min<TSource>(source, selector);
- }
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Single" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable<System.Single>" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float?> Min<TSource>(this IObservable<TSource> source, Func<TSource, float?> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Min<TSource>(source, selector);
- }
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Decimal" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable<System.Decimal>" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal?> Min<TSource>(this IObservable<TSource> source, Func<TSource, decimal?> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Min<TSource>(source, selector);
- }
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Int32" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable<System.Int32>" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int?> Min<TSource>(this IObservable<TSource> source, Func<TSource, int?> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Min<TSource>(source, selector);
- }
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Int64" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable<System.Int64>" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long?> Min<TSource>(this IObservable<TSource> source, Func<TSource, long?> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return s_impl.Min<TSource>(source, selector);
- }
- #endregion
- #region + MinBy +
- /// <summary>
- /// Returns the elements in an observable sequence with the minimum key value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to get the minimum elements for.</param>
- /// <param name="keySelector">Key selector function.</param>
- /// <returns>An observable sequence containing a list of zero or more elements that have a minimum key value.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<IList<TSource>> MinBy<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (keySelector == null)
- throw new ArgumentNullException(nameof(keySelector));
- return s_impl.MinBy<TSource, TKey>(source, keySelector);
- }
- /// <summary>
- /// Returns the elements in an observable sequence with the minimum key value according to the specified comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to get the minimum elements for.</param>
- /// <param name="keySelector">Key selector function.</param>
- /// <param name="comparer">Comparer used to compare key values.</param>
- /// <returns>An observable sequence containing a list of zero or more elements that have a minimum key value.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<IList<TSource>> MinBy<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
- return s_impl.MinBy<TSource, TKey>(source, keySelector, comparer);
- }
- #endregion
- #region + SequenceEqual +
- /// <summary>
- /// Determines whether two sequences are equal by comparing the elements pairwise.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="first">First observable sequence to compare.</param>
- /// <param name="second">Second observable sequence to compare.</param>
- /// <returns>An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the default equality comparer for their type.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="first"/> or <paramref name="second"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<bool> SequenceEqual<TSource>(this IObservable<TSource> first, IObservable<TSource> second)
- {
- if (first == null)
- throw new ArgumentNullException(nameof(first));
- if (second == null)
- throw new ArgumentNullException(nameof(second));
- return s_impl.SequenceEqual<TSource>(first, second);
- }
- /// <summary>
- /// Determines whether two sequences are equal by comparing the elements pairwise using a specified equality comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="first">First observable sequence to compare.</param>
- /// <param name="second">Second observable sequence to compare.</param>
- /// <param name="comparer">Comparer used to compare elements of both sequences.</param>
- /// <returns>An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the specified equality comparer.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="first"/> or <paramref name="second"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<bool> SequenceEqual<TSource>(this IObservable<TSource> first, IObservable<TSource> second, IEqualityComparer<TSource> comparer)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
- return s_impl.SequenceEqual<TSource>(first, second, comparer);
- }
- /// <summary>
- /// Determines whether an observable and enumerable sequence are equal by comparing the elements pairwise.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="first">First observable sequence to compare.</param>
- /// <param name="second">Second observable sequence to compare.</param>
- /// <returns>An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the default equality comparer for their type.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="first"/> or <paramref name="second"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<bool> SequenceEqual<TSource>(this IObservable<TSource> first, IEnumerable<TSource> second)
- {
- if (first == null)
- throw new ArgumentNullException(nameof(first));
- if (second == null)
- throw new ArgumentNullException(nameof(second));
- return s_impl.SequenceEqual<TSource>(first, second);
- }
- /// <summary>
- /// Determines whether an observable and enumerable sequence are equal by comparing the elements pairwise using a specified equality comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="first">First observable sequence to compare.</param>
- /// <param name="second">Second observable sequence to compare.</param>
- /// <param name="comparer">Comparer used to compare elements of both sequences.</param>
- /// <returns>An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the specified equality comparer.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="first"/> or <paramref name="second"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<bool> SequenceEqual<TSource>(this IObservable<TSource> first, IEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
- return s_impl.SequenceEqual<TSource>(first, second, comparer);
- }
- #endregion
- #region + SingleAsync +
- /// <summary>
- /// Returns the only element of an observable sequence, and reports an exception if there is not exactly one element in the observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>Sequence containing the single element in the observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence contains more than one element. -or- The source sequence is empty.</exception>
- public static IObservable<TSource> SingleAsync<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.SingleAsync<TSource>(source);
- }
- /// <summary>
- /// Returns the only element of an observable sequence that satisfies the condition in the predicate, and reports an exception if there is not exactly one element in the observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
- /// <returns>Sequence containing the single element in the observable sequence that satisfies the condition in the predicate.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) No element satisfies the condition in the predicate. -or- More than one element satisfies the condition in the predicate. -or- The source sequence is empty.</exception>
- public static IObservable<TSource> SingleAsync<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (predicate == null)
- throw new ArgumentNullException(nameof(predicate));
- return s_impl.SingleAsync<TSource>(source, predicate);
- }
- #endregion
- #region + SingleOrDefaultAsync +
- /// <summary>
- /// Returns the only element of an observable sequence, or a default value if the observable sequence is empty; this method reports an exception if there is more than one element in the observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>Sequence containing the single element in the observable sequence, or a default value if no such element exists.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence contains more than one element.</exception>
- public static IObservable<TSource> SingleOrDefaultAsync<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.SingleOrDefaultAsync<TSource>(source);
- }
- /// <summary>
- /// Returns the only element of an observable sequence that matches the predicate, or a default value if no such element exists; this method reports an exception if there is more than one element in the observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
- /// <returns>Sequence containing the single element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The sequence contains more than one element that satisfies the condition in the predicate.</exception>
- public static IObservable<TSource> SingleOrDefaultAsync<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
- return s_impl.SingleOrDefaultAsync<TSource>(source, predicate);
- }
- #endregion
- #region + Sum +
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Double" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Double" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double> Sum(this IObservable<double> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Sum(source);
- }
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Single" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Single" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float> Sum(this IObservable<float> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.Sum(source);
- }
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Decimal" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Decimal" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal> Sum(this IObservable<decimal> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- return s_impl.Sum(source);
- }
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Int32" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Int32" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int32.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int> Sum(this IObservable<int> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- return s_impl.Sum(source);
- }
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Int64" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Int64" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long> Sum(this IObservable<long> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- return s_impl.Sum(source);
- }
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Double" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Double" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double?> Sum(this IObservable<double?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- return s_impl.Sum(source);
- }
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Single" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Single" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float?> Sum(this IObservable<float?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- return s_impl.Sum(source);
- }
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Decimal" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Decimal" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal?> Sum(this IObservable<decimal?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- return s_impl.Sum(source);
- }
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Int32" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Int32" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int32.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int?> Sum(this IObservable<int?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- return s_impl.Sum(source);
- }
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Int64" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Int64" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long?> Sum(this IObservable<long?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- return s_impl.Sum(source);
- }
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Double" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double> Sum<TSource>(this IObservable<TSource> source, Func<TSource, double> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- return s_impl.Sum<TSource>(source, selector);
- }
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Single" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float> Sum<TSource>(this IObservable<TSource> source, Func<TSource, float> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- return s_impl.Sum<TSource>(source, selector);
- }
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Decimal" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal> Sum<TSource>(this IObservable<TSource> source, Func<TSource, decimal> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- return s_impl.Sum<TSource>(source, selector);
- }
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Int32" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int32.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int> Sum<TSource>(this IObservable<TSource> source, Func<TSource, int> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- return s_impl.Sum<TSource>(source, selector);
- }
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Int64" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long> Sum<TSource>(this IObservable<TSource> source, Func<TSource, long> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- return s_impl.Sum<TSource>(source, selector);
- }
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Double" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double?> Sum<TSource>(this IObservable<TSource> source, Func<TSource, double?> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- return s_impl.Sum<TSource>(source, selector);
- }
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Single" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float?> Sum<TSource>(this IObservable<TSource> source, Func<TSource, float?> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- return s_impl.Sum<TSource>(source, selector);
- }
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Decimal" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal?> Sum<TSource>(this IObservable<TSource> source, Func<TSource, decimal?> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- return s_impl.Sum<TSource>(source, selector);
- }
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Int32" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int32.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int?> Sum<TSource>(this IObservable<TSource> source, Func<TSource, int?> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- return s_impl.Sum<TSource>(source, selector);
- }
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Int64" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long?> Sum<TSource>(this IObservable<TSource> source, Func<TSource, long?> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- return s_impl.Sum<TSource>(source, selector);
- }
- #endregion
- #region + ToArray +
- /// <summary>
- /// Creates an array from an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">The source observable sequence to get an array of elements for.</param>
- /// <returns>An observable sequence containing a single element with an array containing all the elements of the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<TSource[]> ToArray<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- return s_impl.ToArray<TSource>(source);
- }
- #endregion
- #region + ToDictionary +
- /// <summary>
- /// Creates a dictionary from an observable sequence according to a specified key selector function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the dictionary key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to create a dictionary for.</param>
- /// <param name="keySelector">A function to extract a key from each element.</param>
- /// <returns>An observable sequence containing a single element with a dictionary mapping unique key values onto the corresponding source sequence's element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<IDictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- return s_impl.ToDictionary<TSource, TKey>(source, keySelector);
- }
- /// <summary>
- /// Creates a dictionary from an observable sequence according to a specified key selector function, and a comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the dictionary key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to create a dictionary for.</param>
- /// <param name="keySelector">A function to extract a key from each element.</param>
- /// <param name="comparer">An equality comparer to compare keys.</param>
- /// <returns>An observable sequence containing a single element with a dictionary mapping unique key values onto the corresponding source sequence's element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<IDictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
- return s_impl.ToDictionary<TSource, TKey>(source, keySelector, comparer);
- }
- /// <summary>
- /// Creates a dictionary from an observable sequence according to a specified key selector function, and an element selector function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the dictionary key computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TElement">The type of the dictionary value computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to create a dictionary for.</param>
- /// <param name="keySelector">A function to extract a key from each element.</param>
- /// <param name="elementSelector">A transform function to produce a result element value from each element.</param>
- /// <returns>An observable sequence containing a single element with a dictionary mapping unique key values onto the corresponding source sequence's element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="elementSelector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<IDictionary<TKey, TElement>> ToDictionary<TSource, TKey, TElement>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (elementSelector == null)
- throw new ArgumentNullException("elementSelector");
- return s_impl.ToDictionary<TSource, TKey, TElement>(source, keySelector, elementSelector);
- }
- /// <summary>
- /// Creates a dictionary from an observable sequence according to a specified key selector function, a comparer, and an element selector function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the dictionary key computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TElement">The type of the dictionary value computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to create a dictionary for.</param>
- /// <param name="keySelector">A function to extract a key from each element.</param>
- /// <param name="elementSelector">A transform function to produce a result element value from each element.</param>
- /// <param name="comparer">An equality comparer to compare keys.</param>
- /// <returns>An observable sequence containing a single element with a dictionary mapping unique key values onto the corresponding source sequence's element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="elementSelector"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<IDictionary<TKey, TElement>> ToDictionary<TSource, TKey, TElement>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (elementSelector == null)
- throw new ArgumentNullException("elementSelector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
- return s_impl.ToDictionary<TSource, TKey, TElement>(source, keySelector, elementSelector, comparer);
- }
- #endregion
- #region + ToList +
- /// <summary>
- /// Creates a list from an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">The source observable sequence to get a list of elements for.</param>
- /// <returns>An observable sequence containing a single element with a list containing all the elements of the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<IList<TSource>> ToList<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- return s_impl.ToList<TSource>(source);
- }
- #endregion
- #region + ToLookup +
- /// <summary>
- /// Creates a lookup from an observable sequence according to a specified key selector function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the lookup key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to create a lookup for.</param>
- /// <param name="keySelector">A function to extract a key from each element.</param>
- /// <returns>An observable sequence containing a single element with a lookup mapping unique key values onto the corresponding source sequence's elements.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (keySelector == null)
- throw new ArgumentNullException(nameof(keySelector));
- return s_impl.ToLookup<TSource, TKey>(source, keySelector);
- }
- /// <summary>
- /// Creates a lookup from an observable sequence according to a specified key selector function, and a comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the lookup key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to create a lookup for.</param>
- /// <param name="keySelector">A function to extract a key from each element.</param>
- /// <param name="comparer">An equality comparer to compare keys.</param>
- /// <returns>An observable sequence containing a single element with a lookup mapping unique key values onto the corresponding source sequence's elements.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (keySelector == null)
- throw new ArgumentNullException(nameof(keySelector));
- if (comparer == null)
- throw new ArgumentNullException(nameof(comparer));
- return s_impl.ToLookup<TSource, TKey>(source, keySelector, comparer);
- }
- /// <summary>
- /// Creates a lookup from an observable sequence according to a specified key selector function, and an element selector function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the lookup key computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TElement">The type of the lookup value computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to create a lookup for.</param>
- /// <param name="keySelector">A function to extract a key from each element.</param>
- /// <param name="elementSelector">A transform function to produce a result element value from each element.</param>
- /// <returns>An observable sequence containing a single element with a lookup mapping unique key values onto the corresponding source sequence's elements.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="elementSelector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (keySelector == null)
- throw new ArgumentNullException(nameof(keySelector));
- if (elementSelector == null)
- throw new ArgumentNullException(nameof(elementSelector));
- return s_impl.ToLookup<TSource, TKey, TElement>(source, keySelector, elementSelector);
- }
- /// <summary>
- /// Creates a lookup from an observable sequence according to a specified key selector function, a comparer, and an element selector function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the lookup key computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TElement">The type of the lookup value computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to create a lookup for.</param>
- /// <param name="keySelector">A function to extract a key from each element.</param>
- /// <param name="elementSelector">A transform function to produce a result element value from each element.</param>
- /// <param name="comparer">An equality comparer to compare keys.</param>
- /// <returns>An observable sequence containing a single element with a lookup mapping unique key values onto the corresponding source sequence's elements.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="elementSelector"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (keySelector == null)
- throw new ArgumentNullException(nameof(keySelector));
- if (elementSelector == null)
- throw new ArgumentNullException(nameof(elementSelector));
- if (comparer == null)
- throw new ArgumentNullException(nameof(comparer));
- return s_impl.ToLookup<TSource, TKey, TElement>(source, keySelector, elementSelector, comparer);
- }
- #endregion
- }
- }
|