Class ACKRangeCollection
Abstract base class for all collection types based on a Word range. Provides IsDirty tracking, deferCOM lazy activation, and cache helpers.
Implements
Inherited Members
Namespace: CoverageKiller2.DOM
Assembly: CoverageKiller2.dll
Syntax
public abstract class ACKRangeCollection : IDOMObject
Constructors
ACKRangeCollection(IDOMObject, bool)
Initializes a new instance of the ACKRangeCollection class.
Declaration
protected ACKRangeCollection(IDOMObject parent, bool deferCOM = false)
Parameters
Type | Name | Description |
---|---|---|
IDOMObject | parent | The parent DOM object. |
bool | deferCOM | If true, defers COM access until first real usage. |
Properties
Application
Gets the CKApplication instance that owns the document.
Declaration
public CKApplication Application { get; }
Property Value
Type | Description |
---|---|
CKApplication |
Count
Gets the number of items in the collection.
Declaration
public abstract int Count { get; }
Property Value
Type | Description |
---|---|
int |
Document
Gets the CKDocument that owns this DOM object.
Declaration
public CKDocument Document { get; }
Property Value
Type | Description |
---|---|
CKDocument |
IsCOMDeferred
Indicates whether COM access has been deferred for this collection. Flipped internally during first cache or IsDirty check if needed.
Declaration
public bool IsCOMDeferred { get; }
Property Value
Type | Description |
---|---|
bool |
IsDirty
Indicates whether this DOM object has unsaved changes.
Declaration
public virtual bool IsDirty { get; protected set; }
Property Value
Type | Description |
---|---|
bool |
IsOrphan
Determines whether the collection has lost association with the underlying Word objects.
Declaration
public abstract bool IsOrphan { get; }
Property Value
Type | Description |
---|---|
bool |
Parent
Declaration
public IDOMObject Parent { get; protected set; }
Property Value
Type | Description |
---|---|
IDOMObject |
_isDirty
Tracks dirty state for cache invalidation.
Declaration
protected bool _isDirty { get; set; }
Property Value
Type | Description |
---|---|
bool |
Methods
Cache<T>(ref T)
Provides lazy cache loading for a field, automatically lifting defer if necessary.
Declaration
protected T Cache<T>(ref T cachedField)
Parameters
Type | Name | Description |
---|---|---|
T | cachedField | The field to cache. |
Returns
Type | Description |
---|---|
T | The cached value, refreshed if needed. |
Type Parameters
Name | Description |
---|---|
T | The field type. |
Cache<T>(ref T, Func<T>)
Provides lazy cache loading for a field with a custom refresh function.
Declaration
protected T Cache<T>(ref T cachedField, Func<T> refreshFunc)
Parameters
Type | Name | Description |
---|---|---|
T | cachedField | The field to cache. |
Func<T> | refreshFunc | A function to refresh the cache. |
Returns
Type | Description |
---|---|
T | The cached value, refreshed if needed. |
Type Parameters
Name | Description |
---|---|
T | The field type. |
CheckDirtyFor()
Checks whether the collection has become dirty. Override in descendants to customize.
Declaration
protected virtual bool CheckDirtyFor()
Returns
Type | Description |
---|---|
bool | True if dirty; otherwise, false. |
Clear()
Clears the collection cache.
Declaration
public abstract void Clear()
DoRefreshThings()
Declaration
protected virtual void DoRefreshThings()
IndexOf(object)
Attempts to find the index of an object within the collection.
Declaration
public abstract int IndexOf(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj |
Returns
Type | Description |
---|---|
int |
Refresh()
Forces the collection to refresh its cache from the underlying COM objects. Descendants should override this to implement their specific refresh logic.
Declaration
public void Refresh()
SetCache<T>(ref T, T, Action<T>)
Declaration
protected void SetCache<T>(ref T field, T value, Action<T> setter = null)
Parameters
Type | Name | Description |
---|---|---|
T | field | |
T | value | |
Action<T> | setter |
Type Parameters
Name | Description |
---|---|
T |