Class SubjectMixins
- Namespace
- ReactiveUI.Extensions.Async
- Assembly
- ReactiveUI.Extensions.dll
Provides extension methods for working with subjects in a reactive programming context.
public static class SubjectMixins
- Inheritance
-
SubjectMixins
Remarks
The methods in this class enable interoperability between subjects and asynchronous observer patterns. These extensions are intended to simplify the integration of subjects with APIs that expect asynchronous observers.
Methods
AsObserverAsync<T>(ISubjectAsync<T>)
Creates an asynchronous observer wrapper for the specified subject.
public static IObserverAsync<T> AsObserverAsync<T>(this ISubjectAsync<T> subject)
Parameters
subjectISubjectAsync<T>The subject to wrap as an asynchronous observer. Cannot be null.
Returns
- IObserverAsync<T>
An asynchronous observer that forwards notifications to the specified subject.
Type Parameters
TThe type of the elements processed by the subject and observer.
MapValues<T>(ISubjectAsync<T>, Func<IObservableAsync<T>, IObservableAsync<T>>)
Creates a new subject that applies a transformation to the values of the source subject using the specified mapping function.
public static ISubjectAsync<T> MapValues<T>(this ISubjectAsync<T> @this, Func<IObservableAsync<T>, IObservableAsync<T>> mapper)
Parameters
thisISubjectAsync<T>The source subject whose values are to be mapped.
mapperFunc<IObservableAsync<T>, IObservableAsync<T>>A function that takes an asynchronous observable of type T and returns a transformed asynchronous observable of type T. This function defines how the values are mapped.
Returns
- ISubjectAsync<T>
A subject that emits values transformed by the specified mapping function.
Type Parameters
TThe type of the elements processed by the subject.
Remarks
The returned subject reflects the mapped values of the original subject. Subscribers to the returned subject will observe the transformed sequence as defined by the mapper function. The mapping is applied to all values published by the source subject.