Show / Hide Table of Contents

Class SoftReferenceOptions

Allows to configure behavior of SoftReference<T>.

Inheritance
object
SoftReferenceOptions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DotNext.Runtime
Assembly: DotNext.dll
Syntax
public class SoftReferenceOptions

Properties

| Edit this page View Source

CollectionCount

Indicates how many collections can the referenced object survive.

Declaration
public int CollectionCount { get; init; }
Property Value
Type Description
int
| Edit this page View Source

Default

Gets default options.

Declaration
public static SoftReferenceOptions Default { get; }
Property Value
Type Description
SoftReferenceOptions
| Edit this page View Source

MemoryLimit

Gets the memory limit for Gen2 used as a trigger to release a reference to the object.

Declaration
public long MemoryLimit { get; init; }
Property Value
Type Description
long
Remarks

If soft reference detects that Gen2 occupies more memory than the limit then the referenced object will be marked as available for garbage collection regardless of CollectionCount configuration value.

| Edit this page View Source

MemoryThreshold

Gets the memory threshold.

Declaration
public double MemoryThreshold { get; init; }
Property Value
Type Description
double

The memory threshold; must be in range (0, 1].

Remarks

The default is 1.

Extension Methods

BasicExtensions.As<T>(T)
BasicExtensions.GetUserData<T>(T)
BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, ReadOnlySpan<T>)
ExpressionBuilder.Const<T>(T)
AsyncLockAcquisition.AcquireLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, TimeSpan, CancellationToken)
LockAcquisition.AcquireReadLock<T>(T)
LockAcquisition.AcquireReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireUpgradeableReadLock<T>(T)
LockAcquisition.AcquireUpgradeableReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireWriteLock<T>(T)
LockAcquisition.AcquireWriteLock<T>(T, TimeSpan)
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾