Skip to content

)}

Scope.Create(Action) method

Defined in

Type: Scope Namespace: ReactiveUI.Primitives.Disposables Assembly: ReactiveUI.Disposables.dll

Applies to

net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net462, net481

Overloads

  • 1. public static IDisposable Create(Action dispose)
  • 2. public static IDisposable Create<TState>(TState state, Action<TState> dispose)

1. Overload

public static IDisposable Create(Action dispose)

View source

Summary: Creates a disposable object that invokes the specified action when disposed.

Parameters

NameTypeDescription
disposeActionAction to run during the first call to Dispose. The action is guaranteed to be run at most once.

Returns: IDisposable -- The disposable object that runs the given action upon disposal.

Remarks

A null action returns Empty for backward compatibility with existing ReactiveUI.Primitives create pipelines.

2. Overload

public static IDisposable Create<TState>(TState state, Action<TState> dispose)

View source

Summary: Creates a disposable object that invokes the specified stateful action when disposed.

Type parameters

NameDescription
TStateThe state type.

Parameters

NameTypeDescription
stateTStateState passed to dispose.
disposeActionAction to run during the first call to Dispose.

Returns: IDisposable -- The disposable object that runs the given action upon disposal.