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
Type
Specifies the type of this disposal strategy.
public DependencyImplementorDisposalStrategyType Type { get; }
Property Value
Methods
RenounceOwnership()
Creates a new DependencyImplementorDisposalStrategy instance with RenounceOwnership. This strategy disables the automatic disposal.
[Pure]
public static DependencyImplementorDisposalStrategy RenounceOwnership()
Returns
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
Returns
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
Returns
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()