Characteristic Locus
Inheritance System.Object > ObservableBase<UNIT> > SensorBase<UNIT> > RotaryEncoder
Namespace Meadow.Foundation
Assembly Meadow.Foundation.dll

Syntax

public abstract class ObservableBase<UNIT> : IObservable<IChangeResult<UNIT>> where UNIT : struct

Type Parameters

Name Description
UNIT

Properties

observers

Declaration
protected List<IObserver<IChangeResult<UNIT>>> observers { get; set; }

Property Value

Type Description
List<IObserver<IChangeResult<UNIT>>>

Methods

CreateObserver(Action<IChangeResult<UNIT>>, Nullable<Predicate<IChangeResult<UNIT>>>)

Convenience method to generate a an FilterableChangeObserver with the correct signature.

Declaration
public static FilterableChangeObserver<UNIT> CreateObserver(Action<IChangeResult<UNIT>> handler, Predicate<IChangeResult<UNIT>>? filter = null)

Parameters

Type Name Description
Action<IChangeResult<UNIT>> handler

The action that is invoked when the filter is satisifed.

System.Nullable<Predicate<IChangeResult<UNIT>>> filter

An optional filter that determines whether or not the consumer should be notified.

Returns

Type Description
FilterableChangeObserver<UNIT>

A FilterableChangeObserver

NotifyObservers(IChangeResult<UNIT>)

Declaration
protected void NotifyObservers(IChangeResult<UNIT> changeResult)

Parameters

Type Name Description
IChangeResult<UNIT> changeResult

Subscribe(IObserver<IChangeResult<UNIT>>)

Subscribes an IObserver to get notified when a change occurs.

Declaration
public IDisposable Subscribe(IObserver<IChangeResult<UNIT>> observer)

Parameters

Type Name Description
IObserver<IChangeResult<UNIT>> observer

The IObserver that will receive the change notifications.

Returns

Type Description
IDisposable