New to Telerik Document ProcessingStart a free 30-day trial

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.

Definition

Namespace:Telerik.Windows.Documents.Spreadsheet.Expressions.DataStructures

Assembly:Telerik.Windows.Documents.Spreadsheet.dll

Type Parameters:

T

The value type stored by the collection.

Syntax:

C#
public class CompressedCollection<T> : IEnumerable<T>, IEnumerable

Inheritance: objectCompressedCollection<T>

Derived Classes: CompressedExpressionCollection

Implements: IEnumerableIEnumerable<T>

Constructors

Initializes a new instance of the CompressedCollection class with specified dimensions and default value for unset cells.

C#
public CompressedCollection(int rowCount, int columnCount, T defaultValue)
Parameters:rowCountint

The number of rows.

columnCountint

The number of columns.

defaultValueT

The default value used to initialize all cells of the collection.

Methods

Returns an enumerator that iterates through all logical positions in row-major order, yielding default values for unset cells.

C#
public IEnumerator<T> GetEnumerator()
Returns:

IEnumerator<T>

The enumerator.

Implements: IEnumerable<T>.GetEnumerator()

Returns the size of the specified dimension: 0 for row count, 1 for column count.

C#
public int GetLength(int dimension)
Parameters:dimensionint

The dimension for which to get the length. 0 for rows, 1 for columns.

Returns:

int

The number of items in the selected dimension.

Properties

Indicates whether any values have been explicitly set in the collection.

C#
public bool HasValues { get; }

The total logical capacity of the collection, representing all positions including unset ones.

C#
public int Length { get; }

Accesses the value at the specified row and column, returning the default value if the cell has not been explicitly set.

C#
public T this[int rowIndex, int columnIndex] { get; set; }
Parameters:rowIndexint

The row index of the cell.

columnIndexint

The column index of the cell.