Table of Contents

Class DisposalScope

Namespace
SharpConsoleUI.Core
Assembly
SharpConsoleUI.dll

A disposal scope that can register resources for disposal when the scope is disposed

public sealed class DisposalScope : IDisposable, IAsyncDisposable
Inheritance
DisposalScope
Implements
Inherited Members

Properties

IsDisposed

Gets whether the scope has been disposed

public bool IsDisposed { get; }

Property Value

bool

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

DisposeAsync()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

public ValueTask DisposeAsync()

Returns

ValueTask

A task that represents the asynchronous dispose operation.

RegisterAsync<T>(T)

Registers an async disposable resource in this scope

public T RegisterAsync<T>(T asyncDisposable) where T : IAsyncDisposable

Parameters

asyncDisposable T

The async disposable resource

Returns

T

The registered resource for fluent chaining

Type Parameters

T

RegisterDisposalAction(Action)

Registers a disposal action for this scope

public void RegisterDisposalAction(Action disposalAction)

Parameters

disposalAction Action

The disposal action

Register<T>(T)

Registers a disposable resource in this scope

public T Register<T>(T disposable) where T : IDisposable

Parameters

disposable T

The disposable resource

Returns

T

The registered resource for fluent chaining

Type Parameters

T