1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554 |
- // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license 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("source");
- if (accumulator == null)
- throw new ArgumentNullException("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("source");
- if (accumulator == null)
- throw new ArgumentNullException("accumulator");
- if (resultSelector == null)
- throw new ArgumentNullException("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("source");
- if (accumulator == null)
- throw new ArgumentNullException("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("source");
- if (predicate == null)
- throw new ArgumentNullException("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("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("source");
- if (predicate == null)
- throw new ArgumentNullException("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("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("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("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("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("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("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("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("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("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("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("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("source");
- if (comparer == null)
- throw new ArgumentNullException("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("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("source");
- if (predicate == null)
- throw new ArgumentNullException("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("source");
- if (index < 0)
- throw new ArgumentOutOfRangeException("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("source");
- if (index < 0)
- throw new ArgumentOutOfRangeException("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("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("source");
- if (predicate == null)
- throw new ArgumentNullException("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("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("source");
- if (predicate == null)
- throw new ArgumentNullException("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("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("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("source");
- if (predicate == null)
- throw new ArgumentNullException("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("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("source");
- if (predicate == null)
- throw new ArgumentNullException("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("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("source");
- if (predicate == null)
- throw new ArgumentNullException("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("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("source");
- if (comparer == null)
- throw new ArgumentNullException("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("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("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("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("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("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("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("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("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("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("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- if (comparer == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (keySelector == null)
- throw new ArgumentNullException("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("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (comparer == null)
- throw new ArgumentNullException("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("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("source");
- if (comparer == null)
- throw new ArgumentNullException("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("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("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("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("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("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("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("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("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("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("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- if (comparer == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (selector == null)
- throw new ArgumentNullException("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("source");
- if (keySelector == null)
- throw new ArgumentNullException("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("first");
- if (second == null)
- throw new ArgumentNullException("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("first");
- if (second == null)
- throw new ArgumentNullException("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("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("source");
- if (predicate == null)
- throw new ArgumentNullException("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("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("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("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("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("source");
- if (keySelector == null)
- throw new ArgumentNullException("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("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (comparer == null)
- throw new ArgumentNullException("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("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (elementSelector == null)
- throw new ArgumentNullException("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("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.ToLookup<TSource, TKey, TElement>(source, keySelector, elementSelector, comparer);
- }
- #endregion
- }
- }
|