Class RefCount<T>
Manages reference counting for a given object. Extensions can override Release() to do custom logic when reference counting hits 0.
Inheritance
System.Object
RefCount<T>
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Lucene.Net.Util
Assembly: Lucene.Net.dll
Syntax
public class RefCount<T>
Type Parameters
Name | Description |
---|---|
T |
Constructors
| Improve this Doc View SourceRefCount(T)
Declaration
public RefCount(T object)
Parameters
Type | Name | Description |
---|---|---|
T | object |
Fields
| Improve this Doc View Sourcem_object
Declaration
protected readonly T m_object
Field Value
Type | Description |
---|---|
T |
Methods
| Improve this Doc View SourceDecRef()
Decrements the reference counting of this object. When reference counting hits 0, calls Release().
Declaration
public void DecRef()
Get()
Declaration
public T Get()
Returns
Type | Description |
---|---|
T |
GetRefCount()
Returns the current reference count.
Declaration
public int GetRefCount()
Returns
Type | Description |
---|---|
System.Int32 |
IncRef()
Increments the reference count. Calls to this method must be matched with calls to DecRef().
Declaration
public void IncRef()
Release()
Called when reference counting hits 0. By default this method does nothing, but extensions can override to e.g. release resources attached to object that is managed by this class.
Declaration
protected virtual void Release()