Table of Contents

Struct DependencyImplementorDisposalStrategy

Namespace
LfrlAnvil.Dependencies
Assembly
LfrlAnvil.Dependencies.dll

Represents a descriptor of dependency implementor's automatic disposal strategy.

public readonly struct DependencyImplementorDisposalStrategy
Inherited Members

Properties

Callback

Specifies the optional disposal callback for UseCallback Type.

public Delegate? Callback { get; }

Property Value

Delegate

Type

Specifies the type of this disposal strategy.

public DependencyImplementorDisposalStrategyType Type { get; }

Property Value

DependencyImplementorDisposalStrategyType

Methods

RenounceOwnership()

Creates a new DependencyImplementorDisposalStrategy instance with RenounceOwnership. This strategy disables the automatic disposal.

[Pure]
public static DependencyImplementorDisposalStrategy RenounceOwnership()

Returns

DependencyImplementorDisposalStrategy

New DependencyImplementorDisposalStrategy instance.

ToString()

Returns a string representation of this DependencyImplementorDisposalStrategy instance.

[Pure]
public override string ToString()

Returns

string

String representation.

UseCallback(Action<object>)

Creates a new DependencyImplementorDisposalStrategy instance with UseCallback and custom callback.

[Pure]
public static DependencyImplementorDisposalStrategy UseCallback(Action<object> callback)

Parameters

callback Action<object>

Custom disposal callback.

Returns

DependencyImplementorDisposalStrategy

New DependencyImplementorDisposalStrategy instance.

UseCallback(Func<object, ValueTask>)

Creates a new DependencyImplementorDisposalStrategy instance with UseCallback and custom asynchronous callback.

[Pure]
public static DependencyImplementorDisposalStrategy UseCallback(Func<object, ValueTask> callback)

Parameters

callback Func<object, ValueTask>

Custom asynchronous disposal callback.

Returns

DependencyImplementorDisposalStrategy

New DependencyImplementorDisposalStrategy instance.

UseDisposableInterface()

Creates a new DependencyImplementorDisposalStrategy instance with UseDisposableInterface type. This is the default automatic disposal strategy that invokes the DisposeAsync() method if an object implements the IAsyncDisposable interface, or invokes the Dispose() method if an object implements the IDisposable interface.

[Pure]
public static DependencyImplementorDisposalStrategy UseDisposableInterface()

Returns

DependencyImplementorDisposalStrategy

New DependencyImplementorDisposalStrategy instance.