Edit

Share via


ObserverManager<TIdentity,TObserver> Class

Definition

Maintains a collection of observers.

public class ObserverManager<TIdentity,TObserver> : System.Collections.Generic.IEnumerable<TObserver>
type ObserverManager<'Identity, 'Observer> = class
    interface seq<'Observer>
    interface IEnumerable
Public Class ObserverManager(Of TIdentity, TObserver)
Implements IEnumerable(Of TObserver)

Type Parameters

TIdentity

The address type, used to identify observers.

TObserver

The observer type.

Inheritance
ObserverManager<TIdentity,TObserver>
Derived
Implements

Constructors

ObserverManager<TIdentity,TObserver>(TimeSpan, ILogger)

Initializes a new instance of the ObserverManager<TIdentity,TObserver> class.

Properties

Count

Gets the number of observers.

ExpirationDuration

Gets or sets the expiration time span, after which observers are lazily removed.

GetDateTime

Gets or sets the delegate used to get the date and time, for expiry.

Observers

Gets a copy of the observers.

Methods

Clear()

Removes all observers.

ClearExpired()

Removed all expired observers.

GetEnumerator()

Returns an enumerator that iterates through the collection.

Notify(Action<TObserver>, Func<TObserver,Boolean>)

Notifies all observers which match the provided predicate.

Notify(Func<TObserver,Task>, Func<TObserver,Boolean>)

Notifies all observers.

Subscribe(TIdentity, TObserver)

Ensures that the provided observer is subscribed, renewing its subscription.

Unsubscribe(TIdentity)

Ensures that the provided id is unsubscribed.

Explicit Interface Implementations

IEnumerable.GetEnumerator()

Returns an enumerator that iterates through a collection.

Extension Methods

BatchIEnumerable<T>(IEnumerable<T>, Int32)

Applies to