DotNext by .NET Foundation and Contributors

<PackageReference Include="DotNext" Version="4.13.0" />

 SoftReferenceOptions

public class SoftReferenceOptions
Allows to configure behavior of SoftReference<T>.
public static SoftReferenceOptions Default { get; }

Gets default options.

public int CollectionCount { get; set; }

Indicates how many collections can the referenced object survive.

public long MemoryLimit { get; set; }

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

public double MemoryThreshold { get; set; }

Gets the memory threshold.