Class CompressedCollection<T>
Sparse collection storing only explicitly set values while appearing to contain values at all indexes, using a default value for unset positions. Enables efficient memory usage for large, mostly-empty grids such as worksheet cell data.
Inheritance
Inherited Members
Namespace: Telerik.Windows.Documents.Spreadsheet.Expressions.DataStructures
Assembly: Telerik.Windows.Documents.Spreadsheet.dll
Syntax
public class CompressedCollection<T> : IEnumerable<T>, IEnumerable
Type Parameters
|
T
The value type stored by the collection. |
Constructors
CompressedCollection(Int32, Int32, T)
Initializes a new instance of the CompressedCollection class with specified dimensions and default value for unset cells.
Declaration
public CompressedCollection(int rowCount, int columnCount, T defaultValue)
Parameters
|
System.Int32
rowCount
The number of rows. |
|
System.Int32
columnCount
The number of columns. |
|
T
defaultValue
The default value used to initialize all cells of the collection. |
Properties
HasValues
Indicates whether any values have been explicitly set in the collection.
Declaration
public bool HasValues { get; }
Property Value
|
System.Boolean
|
Item[Int32, Int32]
Accesses the value at the specified row and column, returning the default value if the cell has not been explicitly set.
Declaration
public T this[int rowIndex, int columnIndex] { get; set; }
Parameters
|
System.Int32
rowIndex
The row index of the cell. |
|
System.Int32
columnIndex
The column index of the cell. |
Property Value
|
T
|
Length
The total logical capacity of the collection, representing all positions including unset ones.
Declaration
public int Length { get; }
Property Value
|
System.Int32
|
Methods
GetEnumerator()
Returns an enumerator that iterates through all logical positions in row-major order, yielding default values for unset cells.
Declaration
public IEnumerator<T> GetEnumerator()
Returns
|
System.Collections.Generic.IEnumerator<T>
The enumerator. |
Implements
GetLength(Int32)
Returns the size of the specified dimension: 0 for row count, 1 for column count.
Declaration
public int GetLength(int dimension)
Parameters
|
System.Int32
dimension
The dimension for which to get the length. 0 for rows, 1 for columns. |
Returns
|
System.Int32
The number of items in the selected dimension. |
Explicit Interface Implementations
IEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
|
System.Collections.IEnumerator
|