LocalActionDisposable Struct
- Obsolete: Types with embedded references are not supported in this version of your compiler.
Implements IDisposable by invoking a given Action upon disposal.
This type should be used instead of ActionDisposable when needed in a local scope, as it avoids a heap allocation.
[Obsolete("Types with embedded references are not supported in this version of your compiler.", true)]
public ref struct LocalActionDisposableConstructors
| Name | Description |
|---|---|
| LocalActionDisposable(Action) | Initializes a new instance of the LocalActionDisposable struct. |
LocalActionDisposable(Action)
Initializes a new instance of the LocalActionDisposable struct.
public LocalActionDisposable(Action onDispose)Parameters
onDisposeAction- The
Actionto call upon the first call toLocalActionDisposable.Dispose.
Exceptions
ArgumentNullExceptiononDisposeisnull.
See also
Methods
| Name | Description |
|---|---|
| Dispose() | When invoked for the first time, invokes the Action passed to the constructor. If / when invoked again, this method does nothing. |