Class EventPatternSourceBase<TSender, TEventArgs>
Base class for classes that expose an observable sequence as a well-known event pattern (sender, event arguments). Contains functionality to maintain a map of event handler delegates to observable sequence subscriptions. Subclasses should only add an event with custom add and remove methods calling into the base class's operations.
Inherited Members
Namespace: System.Reactive
Assembly: System.Reactive.Linq.dll
Syntax
public abstract class EventPatternSourceBase<TSender, TEventArgs>
where TEventArgs : EventArgs
Type Parameters
Name | Description |
---|---|
TSender | The type of the sender that raises the event. |
TEventArgs | The type of the event data generated by the event. |
Constructors
| Improve this Doc View SourceEventPatternSourceBase(IObservable<EventPattern<TSender, TEventArgs>>, Action<Action<TSender, TEventArgs>, EventPattern<TSender, TEventArgs>>)
Creates a new event pattern source.
Declaration
protected EventPatternSourceBase(IObservable<EventPattern<TSender, TEventArgs>> source, Action<Action<TSender, TEventArgs>, EventPattern<TSender, TEventArgs>> invokeHandler)
Parameters
Type | Name | Description |
---|---|---|
IObservable<EventPattern<TSender, TEventArgs>> | source | Source sequence to expose as an event. |
Action<Action<TSender, TEventArgs>, EventPattern<TSender, TEventArgs>> | invokeHandler | Delegate used to invoke the event for each element of the sequence. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Methods
| Improve this Doc View SourceAdd(Delegate, Action<TSender, TEventArgs>)
Adds the specified event handler, causing a subscription to the underlying source.
Declaration
protected void Add(Delegate handler, Action<TSender, TEventArgs> invoke)
Parameters
Type | Name | Description |
---|---|---|
Delegate | handler | Event handler to add. The same delegate should be passed to the Remove operation in order to remove the event handler. |
Action<TSender, TEventArgs> | invoke | Invocation delegate to raise the event in the derived class. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Remove(Delegate)
Removes the specified event handler, causing a disposal of the corresponding subscription to the underlying source that was created during the Add operation.
Declaration
protected void Remove(Delegate handler)
Parameters
Type | Name | Description |
---|---|---|
Delegate | handler | Event handler to remove. This should be the same delegate as one that was passed to the Add operation. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|