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)
Summary: Creates a disposable object that invokes the specified action when disposed.
Parameters
| Name | Type | Description |
|---|---|---|
dispose | Action | Action 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)
Summary: Creates a disposable object that invokes the specified stateful action when disposed.
Type parameters
| Name | Description |
|---|---|
TState | The state type. |
Parameters
| Name | Type | Description |
|---|---|---|
state | TState | State passed to dispose. |
dispose | Action | Action to run during the first call to Dispose. |
Returns: IDisposable -- The disposable object that runs the given action upon disposal.