Class DisposableBase
Implements
Namespace: DynamicTesseract
Assembly: IronOcr.dll
Syntax
public abstract class DisposableBase : Object
Deterministic cleanup of native OCR handles is what DisposableBase standardizes across the DynamicTesseract interop layer. Many of those interop types wrap an unmanaged Tesseract or Leptonica resource that must be released promptly, and this abstract base gives them one correct, shared implementation of the dispose pattern instead of each type reinventing it.
A developer rarely names DisposableBase directly; it is the parent that interop wrappers such as ChoiceIterator derive from. What matters when working with any of those subclasses is the contract it defines: IsDisposed reports whether the native resource has already been freed, Dispose releases it, and VerifyNotDisposed guards a member so a call after disposal fails clearly rather than touching a freed handle. The protected Dispose(Boolean) overload is the override point a subclass implements to free its specific handle, and Finalize is the safety net if Dispose is never called. The practical rule is the usual one: dispose any DynamicTesseract object that derives from this base, ideally with a using statement, so native memory is reclaimed at once.
Disposal and lifecycle matter most under load, which the async OCR how-to addresses, and the advanced reading configuration how-to covers deeper engine control.
Constructors
DisposableBase()
Declaration
protected DisposableBase()
Properties
IsDisposed
Declaration
public bool IsDisposed { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Methods
Dispose()
Declaration
public void Dispose()
Dispose(Boolean)
Declaration
public abstract void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | disposing |
Finalize()
Declaration
protected override void Finalize()
VerifyNotDisposed()
Declaration
protected virtual void VerifyNotDisposed()