Table of Contents

Class IdentifierCollection

Namespace
combit.Reporting
Assembly
combit.ListLabel31.CrossPlatform.dll

Represents a collection of identifiers, each associated with an ExpressionValue. This class allows for adding, removing, and accessing values by key, and supports reverting to previous values.

public class IdentifierCollection : IDictionary<string, ExpressionValue>, ICollection<KeyValuePair<string, ExpressionValue>>, IEnumerable<KeyValuePair<string, ExpressionValue>>, IEnumerable, IDisposable
Inheritance
IdentifierCollection
Implements
Inherited Members

Constructors

IdentifierCollection(ListLabel, ILogger?, string)

Initializes a new instance of the IdentifierCollection class with the specified parent.

public IdentifierCollection(ListLabel parent, ILogger? logger, string collectionId)

Parameters

parent ListLabel

The ListLabel instance that owns this identifier collection.

logger ILogger

The logger to be used for logging messages.

collectionId string

The id of the logger, used for logging messages.

Properties

Count

Gets the number of key-value pairs contained in the active dictionary.

public int Count { get; }

Property Value

int

IsReadOnly

Gets a value indicating whether the identifier collection is read-only.

public bool IsReadOnly { get; }

Property Value

bool

this[string]

public ExpressionValue this[string key] { get; set; }

Parameters

key string

Property Value

ExpressionValue

Keys

Gets a collection containing the keys in the active dictionary.

public ICollection<string> Keys { get; }

Property Value

ICollection<string>

Values

Gets a collection containing the values in the active dictionary.

public ICollection<ExpressionValue> Values { get; }

Property Value

ICollection<ExpressionValue>

Methods

Add(KeyValuePair<string, ExpressionValue>)

Adds an item to the ICollection<T>.

public void Add(KeyValuePair<string, ExpressionValue> item)

Parameters

item KeyValuePair<string, ExpressionValue>

The object to add to the ICollection<T>.

Exceptions

NotSupportedException

The ICollection<T> is read-only.

Add(string, object)

Adds a new identifier and associated value to the collection.

public virtual void Add(string name, object value)

Parameters

name string

The key to associate with the value.

value object

The value to associate with the key, which will be converted to an ExpressionValue.

Exceptions

ListLabelException

Thrown if the collection is in revert mode.

Add(string, object?, LlFieldType)

Adds a new identifier and associated value with a specified field type to the collection.

public virtual void Add(string name, object? value, LlFieldType fieldType)

Parameters

name string

The key to associate with the value.

value object

The value to associate with the key.

fieldType LlFieldType

The combit.Reporting.LlFieldType that defines how the value should be interpreted.

Exceptions

ListLabelException

Thrown if the collection is in revert mode.

Add(string, ExpressionValue)

Adds the specified key-value pair to the collection.

public void Add(string key, ExpressionValue value)

Parameters

key string

The key to add.

value ExpressionValue

The ExpressionValue to associate with the key.

Exceptions

ListLabelException

Thrown if the collection is in revert mode.

AddFromInterface(ITableRow)

Adds values from an ITableRow to the collection, using the table name as a prefix.

public virtual void AddFromInterface(ITableRow value)

Parameters

value ITableRow

The ITableRow whose values are to be added.

Remarks

AddFromInterface(ITableRow) does not take 1:1 relations into consideration. If those are required use DefineData(IDataProvider, ITableRow)instead.

AddFromInterface(ITableRow, string)

Adds values from an ITableRow to the collection, using the specified prefix.

public virtual void AddFromInterface(ITableRow value, string prefix)

Parameters

value ITableRow

The ITableRow whose values are to be added.

prefix string

The prefix to apply to all added keys.

Remarks

AddFromInterface(ITableRow, string) does not take 1:1 relations into consideration. If those are required use DefineData(IDataProvider, ITableRow)instead.

AddFromObject(string, object)

Adds values from an object to the collection. The object cannot be a DataTable or DataSet.

public virtual void AddFromObject(string prefix, object value)

Parameters

prefix string

The prefix for the property or field names of the object.

value object

The object whose properties or fields are to be added to the collection.

Exceptions

ListLabelException

Thrown if the object type is unsupported.

AddFromObject(string, object, bool)

Adds values from an object to the collection, optionally limiting to only browsable properties. The object cannot be a DataTable or DataSet.

public virtual void AddFromObject(string prefix, object value, bool onlyBrowsableProperties)

Parameters

prefix string

The prefix for the property or field names of the object.

value object

The object whose properties or fields are to be added to the collection.

onlyBrowsableProperties bool

Indicates whether to add only properties marked as browsable.

Clear()

Removes all items from the ICollection<T>.

public void Clear()

Exceptions

NotSupportedException

The ICollection<T> is read-only.

Contains(KeyValuePair<string, ExpressionValue>)

Determines whether the ICollection<T> contains a specific value.

public bool Contains(KeyValuePair<string, ExpressionValue> item)

Parameters

item KeyValuePair<string, ExpressionValue>

The object to locate in the ICollection<T>.

Returns

bool

true if item is found in the ICollection<T>; otherwise, false.

ContainsKey(string)

Determines whether the IDictionary<TKey, TValue> contains an element with the specified key.

public bool ContainsKey(string key)

Parameters

key string

The key to locate in the IDictionary<TKey, TValue>.

Returns

bool

true if the IDictionary<TKey, TValue> contains an element with the key; otherwise, false.

Exceptions

ArgumentNullException

key is null.

ContainsMissingIdentifiers()

Checks if there are any missing identifiers present. Logs ans returns true if there are missing identifiers, otherwise false.

public bool ContainsMissingIdentifiers()

Returns

bool

A boolean indicating the presence of missing identifiers.

CopyTo(KeyValuePair<string, ExpressionValue>[], int)

Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.

public void CopyTo(KeyValuePair<string, ExpressionValue>[] array, int arrayIndex)

Parameters

array KeyValuePair<string, ExpressionValue>[]

The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing.

arrayIndex int

The zero-based index in array at which copying begins.

Exceptions

ArgumentNullException

array is null.

ArgumentOutOfRangeException

arrayIndex is less than 0.

ArgumentException

The number of elements in the source ICollection<T> is greater than the available space from arrayIndex to the end of the destination array.

CreateSnapshot()

Creates a snapshot of the current object state.

public ShortGuid CreateSnapshot()

Returns

ShortGuid

A combit.Reporting.Helpers.ShortGuid that uniquely identifies the created snapshot.

DefineData(IDataProvider, ITableRow)

Passes the columns of a data row and (recursively) its 1:1-related rows from other tables as either fields or variables.

public void DefineData(IDataProvider dataSource, ITableRow row)

Parameters

dataSource IDataProvider

The data provider to use.

row ITableRow

The table row to define.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Dispose(bool)

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

GetEnumerator()

Returns an enumerator that iterates through the collection.

public IEnumerator<KeyValuePair<string, ExpressionValue>> GetEnumerator()

Returns

IEnumerator<KeyValuePair<string, ExpressionValue>>

An enumerator that can be used to iterate through the collection.

Remove(KeyValuePair<string, ExpressionValue>)

Removes the first occurrence of a specific object from the ICollection<T>.

public bool Remove(KeyValuePair<string, ExpressionValue> item)

Parameters

item KeyValuePair<string, ExpressionValue>

The object to remove from the ICollection<T>.

Returns

bool

true if item was successfully removed from the ICollection<T>; otherwise, false. This method also returns false if item is not found in the original ICollection<T>.

Exceptions

NotSupportedException

The ICollection<T> is read-only.

Remove(string)

Removes the element with the specified key from the IDictionary<TKey, TValue>.

public bool Remove(string key)

Parameters

key string

The key of the element to remove.

Returns

bool

true if the element is successfully removed; otherwise, false. This method also returns false if key was not found in the original IDictionary<TKey, TValue>.

Exceptions

ArgumentNullException

key is null.

NotSupportedException

The IDictionary<TKey, TValue> is read-only.

RemoveSnapshot(ShortGuid)

Removes a previously created snapshot, releasing any resources associated with it.

public void RemoveSnapshot(ShortGuid id)

Parameters

id ShortGuid

The combit.Reporting.Helpers.ShortGuid identifying the snapshot to remove.

ResetToSnapshot(ShortGuid, bool)

Restores the object state to a previously created snapshot and optionally removes the associated snapshot.

public void ResetToSnapshot(ShortGuid id, bool removeSnapshot = true)

Parameters

id ShortGuid

The combit.Reporting.Helpers.ShortGuid identifying the snapshot to restore.

removeSnapshot bool

If true, removes the snapshot after restoring; otherwise, retains the snapshot.

TryGetValue(string, out ExpressionValue)

Gets the value associated with the specified key.

public bool TryGetValue(string key, out ExpressionValue value)

Parameters

key string

The key whose value to get.

value ExpressionValue

When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized.

Returns

bool

true if the object that implements IDictionary<TKey, TValue> contains an element with the specified key; otherwise, false.

Exceptions

ArgumentNullException

key is null.