Struct ReferenceCounted<T>.Scope
Represents a reference that is protected by the counter increment.
Inherited Members
Namespace: DotNext.Threading
Assembly: DotNext.dll
Syntax
public struct ReferenceCounted<T>.Scope : IOptionMonad<T>, ISupplier<object?>, IFunctional, IDisposable
Remarks
Strong reference is a short-lived scope which protects the resource from being disposed.
Properties
View SourceIsValid
Gets a value indicating that this reference is valid and can be used to access the resource.
Declaration
[MemberNotNullWhen(true, "arc")]
public readonly bool IsValid { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Value
Gets the protected resource.
Declaration
public readonly T Value { get; }
Property Value
| Type | Description |
|---|---|
| T |
ValueRef
Gets a reference to the protected resource.
Declaration
public readonly ref T ValueRef { get; }
Property Value
| Type | Description |
|---|---|
| T |
Remarks
This property is useful when the underlying resource is a value type.
Methods
View SourceDispose()
Releases the strong reference.
Declaration
public void Dispose()
Remarks
This method must not be called more than once.