Struct OptionalDisposable<T>
- Namespace
- LfrlAnvil
- Assembly
- LfrlAnvil.Core.dll
A lightweight generic container for an optional disposable object.
public readonly struct OptionalDisposable<T> : IDisposable where T : IDisposable
Type Parameters
T
Object type.
- Implements
- Inherited Members
- Extension Methods
Fields
Empty
Represents an empty disposable, without an underlying object.
public static readonly OptionalDisposable<T> Empty
Field Value
Properties
Value
Optional underlying disposable object.
public T? Value { get; }
Property Value
- T
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Remarks
Disposes the underlying Value if it exists.