-
Notifications
You must be signed in to change notification settings - Fork 0
DiGi.Core.IO.Table.Classes
Represents a column in a table, defining its index, name, and data type.
public class Column : DiGi.Core.Classes.SerializableObject, DiGi.Core.IO.Table.Interfaces.IColumn, DiGi.Core.IO.Table.Interfaces.ITableSerializableObject, DiGi.Core.IO.Table.Interfaces.ITableObject, DiGi.Core.IO.Interfaces.IIOObject, DiGi.Core.Interfaces.IObject, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.INamedObjectInheritance System.Object → DiGi.Core.Classes.Object → DiGi.Core.Classes.SerializableObject → Column
Derived
↳ ExtendedColumn
Implements IColumn, ITableSerializableObject, ITableObject, DiGi.Core.IO.Interfaces.IIOObject, DiGi.Core.Interfaces.IObject, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.INamedObject
Initializes a new instance of the Column class by copying another column.
public Column(DiGi.Core.IO.Table.Classes.Column? column);column Column
The source column to copy from.
Initializes a new instance of the Column class with a specified index.
public Column(int index);index System.Int32
The zero-based index of the column.
Initializes a new instance of the Column class with a specified index and values copied from another column.
public Column(int index, DiGi.Core.IO.Table.Classes.Column? column);index System.Int32
The zero-based index of the column.
column Column
The source column to copy properties from.
Initializes a new instance of the Column class with a specified index, name, and type.
public Column(int index, string? name, System.Type? type);index System.Int32
The zero-based index of the column.
name System.String
The name of the column.
type System.Type
The data type of the column.
Initializes a new instance of the Column class with a specified index and type.
public Column(int index, System.Type? type);index System.Int32
The zero-based index of the column.
type System.Type
The data type of the column.
Initializes a new instance of the Column class with a specified name and type.
public Column(string? name, System.Type? type);name System.String
The name of the column.
type System.Type
The data type of the column.
Initializes a new instance of the Column class from a JSON object.
public Column(System.Text.Json.Nodes.JsonObject? jsonObject);jsonObject System.Text.Json.Nodes.JsonObject
The JSON object containing column data.
Gets or sets the zero-based index of the column.
public int Index { get; set; }Implements Index
Gets the name of the column.
public string? Name { get; }Implements Name
Gets the data type of the column.
public System.Type? Type { get; }Implements Type
Attempts to get a valid value for the column from the provided input, optionally attempting conversion.
public bool TryGetValidValue(object? @in, out object? @out, bool tryConvert=true);The input object to validate or convert.
out System.Object
When this method returns, contains the validated or converted value if successful; otherwise, null.
tryConvert System.Boolean
Whether to attempt conversion if the type is not directly assignable. Defaults to true.
Implements TryGetValidValue(object, object, bool)
System.Boolean
True if a valid value was obtained; otherwise, false.
Represents an extended column in a table with additional metadata such as category and description.
public class ExtendedColumn : DiGi.Core.IO.Table.Classes.Column, DiGi.Core.IO.Table.Interfaces.IExtendedColumn, DiGi.Core.IO.Table.Interfaces.IColumn, DiGi.Core.IO.Table.Interfaces.ITableSerializableObject, DiGi.Core.IO.Table.Interfaces.ITableObject, DiGi.Core.IO.Interfaces.IIOObject, DiGi.Core.Interfaces.IObject, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.INamedObject, DiGi.Core.Interfaces.IDescribableObjectInheritance System.Object → DiGi.Core.Classes.Object → DiGi.Core.Classes.SerializableObject → Column → ExtendedColumn
Implements IExtendedColumn, IColumn, ITableSerializableObject, ITableObject, DiGi.Core.IO.Interfaces.IIOObject, DiGi.Core.Interfaces.IObject, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.INamedObject, DiGi.Core.Interfaces.IDescribableObject
Initializes a new instance of the ExtendedColumn class by copying another extended column.
public ExtendedColumn(DiGi.Core.IO.Table.Classes.ExtendedColumn? extendedColumn);extendedColumn ExtendedColumn
The source extended column to copy from.
Initializes a new instance of the ExtendedColumn class with a specified index.
public ExtendedColumn(int index);index System.Int32
The zero-based index of the column.
Initializes a new instance of the ExtendedColumn class with a specified index and values copied from another extended column.
public ExtendedColumn(int index, DiGi.Core.IO.Table.Classes.ExtendedColumn? extendedColumn);index System.Int32
The zero-based index of the column.
extendedColumn ExtendedColumn
The source extended column to copy properties from.
Initializes a new instance of the ExtendedColumn class with a specified index, name, and type.
public ExtendedColumn(int index, string? name, System.Type? type);index System.Int32
The zero-based index of the column.
name System.String
The name of the column.
type System.Type
The data type of the column.
Initializes a new instance of the ExtendedColumn class with a specified index and type.
public ExtendedColumn(int index, System.Type? type);index System.Int32
The zero-based index of the column.
type System.Type
The data type of the column.
Initializes a new instance of the ExtendedColumn class with a specified name and type.
public ExtendedColumn(string? name, System.Type? type);name System.String
The name of the column.
type System.Type
The data type of the column.
Initializes a new instance of the ExtendedColumn class with specified metadata.
public ExtendedColumn(string? name, System.Type? type, string? category, string? description);name System.String
The name of the column.
type System.Type
The data type of the column.
category System.String
The category of the column.
description System.String
A description of the column's purpose.
Initializes a new instance of the ExtendedColumn class from a JSON object.
public ExtendedColumn(System.Text.Json.Nodes.JsonObject jsonObject);jsonObject System.Text.Json.Nodes.JsonObject
The JSON object containing column data.
Gets or sets the category of the column.
public string? Category { get; set; }Implements Category
Gets or sets a description for the column.
public string? Description { get; set; }Implements Description
Represents a concrete implementation of a table row.
public sealed class Row : DiGi.Core.IO.Table.Classes.Row<DiGi.Core.IO.Table.Classes.Row>Inheritance System.Object → DiGi.Core.IO.Table.Classes.Row<Row> → Row
Initializes a new instance of the Row class by copying another row.
public Row(DiGi.Core.IO.Table.Classes.Row row);row Row
The source row to copy from.
Initializes a new instance of the Row class with a specified index.
public Row(int index);index System.Int32
The zero-based index of the row.
Initializes a new instance of the Row class with a specified index and initial values.
public Row(int index, System.Collections.Generic.IDictionary<int,object?>? values);index System.Int32
The zero-based index of the row.
values System.Collections.Generic.IDictionary<System.Int32,System.Object>
A dictionary containing column indices and their corresponding values.
Creates a shallow copy of the current row.
public override DiGi.Core.IO.Table.Classes.Row? Clone();Implements Clone()
Row
A new instance of the row with copied values.
Represents a base row in a table, providing functionality to manage column values by index.
public abstract class Row<TRow> : DiGi.Core.IO.Table.Interfaces.IRow<TRow>, DiGi.Core.IO.Table.Interfaces.IRow, DiGi.Core.IO.Table.Interfaces.ITableObject, DiGi.Core.IO.Interfaces.IIOObject, DiGi.Core.Interfaces.IObject, DiGi.Core.Interfaces.ICloneableObject<TRow>, DiGi.Core.Interfaces.ICloneableObject
where TRow : DiGi.Core.IO.Table.Classes.Row<TRow>TRow
The type of the row.
Inheritance System.Object → Row<TRow>
Derived
↳ Row
Implements DiGi.Core.IO.Table.Interfaces.IRow<TRow>, IRow, ITableObject, DiGi.Core.IO.Interfaces.IIOObject, DiGi.Core.Interfaces.IObject, DiGi.Core.Interfaces.ICloneableObject<TRow>, DiGi.Core.Interfaces.ICloneableObject
Initializes a new instance of the Row<TRow> class by copying another row.
public Row(DiGi.Core.IO.Table.Classes.Row? row);row Row
The source row to copy from.
Initializes a new instance of the Row<TRow> class with a specified index.
public Row(int index);index System.Int32
The zero-based index of the row.
Initializes a new instance of the Row<TRow> class with a specified index and values copied from another row.
public Row(int index, DiGi.Core.IO.Table.Classes.Row? row);index System.Int32
The zero-based index of the row.
row Row
The source row to copy properties from.
Initializes a new instance of the Row<TRow> class with a specified index and initial values.
public Row(int index, System.Collections.Generic.IDictionary<int,object?>? values);index System.Int32
The zero-based index of the row.
values System.Collections.Generic.IDictionary<System.Int32,System.Object>
A dictionary containing column indices and their corresponding values.
Initializes a new instance of the Row<TRow> class with initial values.
public Row(System.Collections.Generic.IDictionary<int,object?>? values);values System.Collections.Generic.IDictionary<System.Int32,System.Object>
A dictionary containing column indices and their corresponding values.
Gets the number of values currently stored in the row.
public int Count { get; }Gets the zero-based index of the row.
public int Index { get; }Implements Index
Gets a set of all column indices that have values assigned in this row.
public System.Collections.Generic.HashSet<int> Indexes { get; }Implements Indexes
System.Collections.Generic.HashSet<System.Int32>
Gets or sets the value for the specified column index.
public object? this[int index] { get; set; }index System.Int32
The zero-based index of the column.
Implements this[int]
Creates a shallow copy of the current row.
public abstract TRow? Clone();Implements Clone()
TRow
A new instance of the row with copied values.
Retrieves the value for the specified index, optionally converting it to the requested type.
public T? GetValue<T>(int index, T? defaultValue=default(T?), bool tryConvert=true);T
The target type of the value.
index System.Int32
The zero-based index of the column.
defaultValue T
The value to return if no value is found or conversion fails.
tryConvert System.Boolean
Whether to attempt converting the value to type <typeparam typeparamref="T" />.
T
The value at the specified index converted to <typeparam typeparamref="T" />, or the defaultValue.
Retrieves all values in the row as an array.
public object?[] GetValues();Implements GetValues()
System.Object[]
An array of values where the array index corresponds to the column index.
Removes the value for the specified index from the row.
public bool RemoveValue(int index);index System.Int32
The zero-based index of the column to remove.
Implements RemoveValue(int)
System.Boolean
True if the value was successfully removed; otherwise, false.
Attempts to retrieve and convert the value for the specified index to the requested type.
public bool TryGetValue<T>(int index, out T? value);T
The target type of the value.
index System.Int32
The zero-based index of the column.
value T
When this method returns, contains the value if retrieval and conversion succeeded; otherwise, the default value of T.
Implements TryGetValue<T>(int, T)
System.Boolean
True if the value was successfully retrieved and converted; otherwise, false.
Represents a standard table with default Column and Row types.
Behavior and Architecture:
-
Anemic Model Pattern: This class is designed as an anemic data model. It serves strictly as a structured data container holding columns of type Column and rows of type Row, containing minimal internal logic.
-
Extension-Based Logic: All complex operations, queries, mutations, and business logic on this table are implemented as static extension methods in the static partial classes
Query,Modify, andCreate. -
Sorted Indexing: Columns and rows are stored in sorted dictionaries keyed by their index. This guarantees that columns and rows are always ordered sequentially by their index.
-
Dynamic Shifting: Column removal operations shift all subsequent columns and their corresponding values in each row down by one index to maintain contiguous, zero-based column indexing.
-
Default Value Fallback: Accessing a cell via the indexer
this[rowIndex, columnIndex]returns the default value for the column's type if the cell does not exist or has not been populated. -
JSON Serialization: Designed for custom JSON serialization and deserialization using
TableConverterwhich handles column schemas and row value arrays.
public class Table : DiGi.Core.IO.Table.Classes.Table<DiGi.Core.IO.Table.Classes.Column>Inheritance System.Object → DiGi.Core.IO.Table.Classes.Table<Column,Row> → DiGi.Core.IO.Table.Classes.Table<Column> → Table
Initializes a new instance of the Table class.
public Table();Initializes a new instance of the Table class with specified columns.
public Table(System.Collections.Generic.IEnumerable<DiGi.Core.IO.Table.Classes.Column> columns);columns System.Collections.Generic.IEnumerable<Column>
The collection of columns to add to the table.
Adds a new column with default settings.
public DiGi.Core.IO.Table.Classes.Column? AddColumn();Column
The added column, or null if addition failed.
Adds a new column with the specified name and type.
public DiGi.Core.IO.Table.Classes.Column? AddColumn(string? name, System.Type? type=null);name System.String
The name of the new column.
type System.Type
The type of the new column.
Column
The added column, or null if addition failed.
Adds a new column with the specified type.
public DiGi.Core.IO.Table.Classes.Column? AddColumn(System.Type? type);type System.Type
The type of the new column.
Column
The added column, or null if addition failed.
Updates an existing column with a new name and type.
public DiGi.Core.IO.Table.Classes.Column? UpdateColumn(int index, string? name, System.Type? type=null, bool tryConvert=true);index System.Int32
The zero-based index of the column to update.
name System.String
The new name for the column.
type System.Type
The new type for the column.
tryConvert System.Boolean
Whether to attempt conversion of existing row values to the new column type.
Column
A clone of the updated column, or null if update failed.
Represents a base table structure with generic column and row types.
Behavior and Architecture:
-
Anemic Model Pattern: This class is designed as an anemic data model. It serves strictly as a structured data container holding columns and rows, containing minimal internal logic.
-
Extension-Based Logic: All complex operations, queries, mutations, and business logic on this table are implemented as static extension methods in the static partial classes
Query,Modify, andCreate. -
Sorted Indexing: Columns and rows are stored in sorted dictionaries keyed by their index. This guarantees that columns and rows are always ordered sequentially by their index.
-
Dynamic Shifting: Column removal operations (typically found in Modify extensions) shift all subsequent columns and their corresponding values in each row down by one index to maintain contiguous, zero-based column indexing.
-
Default Value Fallback: Accessing a cell via the indexer
this[rowIndex, columnIndex]returns the default value for the column's type if the cell does not exist or has not been populated. -
JSON Serialization: Designed for custom JSON serialization and deserialization using
TableConverterwhich handles column schemas and row value arrays.
public abstract class Table<TColumn,TRow> : DiGi.Core.IO.Table.Interfaces.ITable<TColumn, TRow>, DiGi.Core.IO.Table.Interfaces.ITable, DiGi.Core.IO.Table.Interfaces.ITableObject, DiGi.Core.IO.Interfaces.IIOObject, DiGi.Core.Interfaces.IObject, System.Collections.Generic.IEnumerable<TRow>, System.Collections.IEnumerable
where TColumn : DiGi.Core.IO.Table.Interfaces.IColumn
where TRow : DiGi.Core.IO.Table.Interfaces.IRow<TRow>TColumn
The type of the columns in the table.
TRow
The type of the rows in the table.
Inheritance System.Object → Table<TColumn,TRow>
Derived
↳ Table<TColumn>
Implements DiGi.Core.IO.Table.Interfaces.ITable<TColumn,TRow>, ITable, ITableObject, DiGi.Core.IO.Interfaces.IIOObject, DiGi.Core.Interfaces.IObject, System.Collections.Generic.IEnumerable<TRow>, System.Collections.IEnumerable
Initializes a new instance of the Table<TColumn,TRow> class.
public Table();Initializes a new instance of the Table<TColumn,TRow> class with specified columns.
public Table(System.Collections.Generic.IEnumerable<TColumn> columns);columns System.Collections.Generic.IEnumerable<TColumn>
The collection of columns to add to the table.
Gets the number of columns in the table.
public int ColumnCount { get; }Gets the collection of columns in the table.
public System.Collections.Generic.IEnumerable<TColumn> Columns { get; }Implements Columns
System.Collections.Generic.IEnumerable<TColumn>
Gets the number of rows in the table.
public int RowCount { get; }Gets the collection of rows in the table.
public System.Collections.Generic.IEnumerable<TRow> Rows { get; }Implements Rows
System.Collections.Generic.IEnumerable<TRow>
Gets or sets the value at the specified row and column indices.
public object? this[int rowIndex, int columnIndex] { get; }rowIndex System.Int32
The zero-based index of the row.
columnIndex System.Int32
The zero-based index of the column.
Gets or sets the value for the specified row and column objects.
public object? this[TRow? row, TColumn? column] { get; }row TRow
The row object.
column TColumn
The column object.
Adds a new column to the table.
public TColumn? AddColumn(TColumn? column);column TColumn
The column to add.
Implements AddColumn(UColumn)
TColumn
A clone of the added column with its index assigned, or null if addition failed.
Adds a new row to the table with default values.
public TRow AddRow();TRow
The newly created row.
Adds a new row to the table using column indices and values.
public TRow? AddRow(System.Collections.Generic.IDictionary<int,object?>? values);values System.Collections.Generic.IDictionary<System.Int32,System.Object>
A dictionary of column indices and their corresponding values.
TRow
The added row, or null if addition failed.
Adds a new row to the table using column names and values.
public TRow? AddRow(System.Collections.Generic.IDictionary<string,object?>? values);values System.Collections.Generic.IDictionary<System.String,System.Object>
A dictionary of column names and their corresponding values.
TRow
The added row, or null if addition failed.
Adds a new row to the table using column names and values, with specific text comparison settings.
public TRow? AddRow(System.Collections.Generic.IDictionary<string,object?> values, DiGi.Core.Enums.TextComparisonType textComparisonType, bool caseSensitive);values System.Collections.Generic.IDictionary<System.String,System.Object>
A dictionary of column names and their corresponding values.
textComparisonType DiGi.Core.Enums.TextComparisonType
The type of text comparison to use for matching columns.
caseSensitive System.Boolean
Whether the search should be case-sensitive.
TRow
The added row, or null if addition failed.
Adds a new row to the table using column names and values, with a custom column matching function.
public TRow? AddRow(System.Collections.Generic.IDictionary<string,object?>? values, System.Func<string?,string?,bool>? matchColumnFunc);values System.Collections.Generic.IDictionary<System.String,System.Object>
A dictionary of column names and their corresponding values.
matchColumnFunc System.Func<System.String,System.String,System.Boolean>
A function to determine if a provided key matches a column name.
TRow
The added row, or null if addition failed.
Adds a new row to the table using an ordered collection of values.
public TRow? AddRow(System.Collections.Generic.IEnumerable<object?>? values);values System.Collections.Generic.IEnumerable<System.Object>
A sequence of values corresponding to columns in order.
Implements AddRow(IEnumerable<object>)
TRow
The added row, or null if addition failed.
Adds a new row to the table based on an existing row object.
public TRow? AddRow(TRow? row, bool tryConvert=true);row TRow
The source row.
tryConvert System.Boolean
Whether to attempt value conversion if types differ.
TRow
A clone of the added row, or null if addition failed.
Clears all rows and columns from the table.
public void Clear();Clears all rows from the table, keeping the columns intact.
public void ClearRows();Creates a new row instance for the table. Must be implemented by derived classes.
protected abstract TRow CreateRow(int index, System.Collections.Generic.IDictionary<int,object?>? values=null);index System.Int32
The index to assign to the new row.
values System.Collections.Generic.IDictionary<System.Int32,System.Object>
Optional initial values for the row.
TRow
A newly created row instance.
Gets a column by its index.
public TColumn? GetColumn(int index);index System.Int32
The zero-based index of the column.
TColumn
A clone of the column if found; otherwise, default.
Gets the index of a column based on its name and specific text comparison settings.
public int GetColumnIndex(string name, DiGi.Core.Enums.TextComparisonType textComparisonType, bool caseSensitive);name System.String
The name of the column to search for.
textComparisonType DiGi.Core.Enums.TextComparisonType
The type of text comparison to use.
caseSensitive System.Boolean
Whether the search should be case-sensitive.
System.Int32
The zero-based index of the column, or -1 if not found.
Gets the index of a column based on its name.
public int GetColumnIndex(string? name, System.Func<string?,string?,bool>? matchColumnFunc=null);name System.String
The name of the column to search for.
matchColumnFunc System.Func<System.String,System.String,System.Boolean>
An optional custom function to match the name.
System.Int32
The zero-based index of the column, or -1 if not found.
Gets all values for a specific column index across all rows.
public object?[]? GetColumnValues(int columnIndex);columnIndex System.Int32
The zero-based index of the column.
System.Object[]
An array containing the values of the specified column for each row.
Gets all values for a specific column across all rows.
public object?[]? GetColumnValues(TColumn? column);column TColumn
The column object.
System.Object[]
An array containing the values of the specified column for each row, or null if the column is null.
Returns an enumerator that iterates through the rows of the table.
public System.Collections.Generic.IEnumerator<TRow> GetEnumerator();Implements GetEnumerator(), GetEnumerator()
System.Collections.Generic.IEnumerator<TRow>
An enumerator for the rows.
Gets the next available index for a column.
public int GetNextColumnIndex();System.Int32
The next index, or -1 if columns cannot be accessed.
Gets the next available index for a row.
public int GetNextRowIndex();System.Int32
The next index, or -1 if rows cannot be accessed.
Gets a row by its index.
public TRow? GetRow(int index);index System.Int32
The zero-based index of the row.
TRow
A clone of the row if found; otherwise, default.
Gets the value at the specified row and column indices.
public object? GetValue(int rowIndex, int columnIndex);rowIndex System.Int32
The zero-based index of the row.
columnIndex System.Int32
The zero-based index of the column.
System.Object
The value at the specified position.
Gets the value for the specified row and column objects.
public object? GetValue(TRow? row, TColumn? column);row TRow
The row object.
column TColumn
The column object.
System.Object
The value at the intersection of the specified row and column.
Gets the value at the specified row and column indices, cast to the specified type.
public T? GetValue<T>(int rowIndex, int columnIndex);T
The expected type of the value.
rowIndex System.Int32
The zero-based index of the row.
columnIndex System.Int32
The zero-based index of the column.
T
The value cast to specified type, or default if not available or cast failed.
Gets the value for the specified row and column objects, cast to the specified type.
public T? GetValue<T>(TRow? row, TColumn? column);T
The expected type of the value.
row TRow
The row object.
column TColumn
The column object.
T
The value cast to specified type, or default if not available or cast failed.
Gets all values for all rows in the table.
public object?[]?[]? GetValues();System.Object[][]
A jagged array containing all values of all rows.
Gets all values for the specified row index.
public object?[]? GetValues(int rowIndex);rowIndex System.Int32
The zero-based index of the row.
System.Object[]
An array containing the values of the specified row, or null if the row is not found.
Removes a column at the specified index.
public bool RemoveColumn(int index);index System.Int32
The zero-based index of the column to remove.
System.Boolean
True if the column was removed; otherwise, false.
Removes columns at the specified indices and shifts remaining columns to fill gaps.
public System.Collections.Generic.List<int>? RemoveColumns(System.Collections.Generic.IEnumerable<int>? indexes);indexes System.Collections.Generic.IEnumerable<System.Int32>
The collection of zero-based indices of the columns to remove.
System.Collections.Generic.List<System.Int32>
A list of indices that were successfully removed, or null if input was null.
Removes a row at the specified index.
public bool RemoveRow(int index);index System.Int32
The zero-based index of the row to remove.
System.Boolean
True if the row was removed; otherwise, false.
Removes rows at the specified indices and shifts remaining rows to fill gaps.
public System.Collections.Generic.List<int>? RemoveRows(System.Collections.Generic.IEnumerable<int>? indexes);indexes System.Collections.Generic.IEnumerable<System.Int32>
The collection of zero-based indices of the rows to remove.
System.Collections.Generic.List<System.Int32>
A list of indices that were successfully removed, or null if input was null.
Sets the value at the specified row and column indices.
public bool SetValue(int rowIndex, int columnIndex, object? value, bool tryConvert=true);rowIndex System.Int32
The zero-based index of the row.
columnIndex System.Int32
The zero-based index of the column.
value System.Object
The value to set.
tryConvert System.Boolean
Whether to attempt conversion of the value to the column type.
System.Boolean
True if the value was successfully set; otherwise, false.
Attempts to get a column by its name.
public bool TryGetColumn(string? name, out TColumn? column, DiGi.Core.Enums.TextComparisonType textComparisonType=DiGi.Core.Enums.TextComparisonType.Equals, bool caseSensitive=true);name System.String
The name of the column.
column TColumn
When this method returns, contains the column if found; otherwise, null.
textComparisonType DiGi.Core.Enums.TextComparisonType
The type of text comparison to use.
caseSensitive System.Boolean
Whether the search should be case-sensitive.
System.Boolean
True if the column was found; otherwise, false.
Attempts to get a valid value for the specified column index.
public bool TryGetValidValue(int columnIndex, object? @in, out object? @out, bool tryConvert=true);columnIndex System.Int32
The zero-based index of the column.
The value to validate/convert.
out System.Object
When this method returns, contains the validated/converted value if successful; otherwise, null.
tryConvert System.Boolean
Whether to attempt conversion of the value to the column type.
System.Boolean
True if a valid value was obtained; otherwise, false.
Attempts to get a value from the specified row and column indices, cast to type T.
public bool TryGetValue<T>(int rowIndex, int columnIndex, out T? value);T
The expected type of the value.
rowIndex System.Int32
The zero-based index of the row.
columnIndex System.Int32
The zero-based index of the column.
value T
When this method returns, contains the value if found and cast successfully; otherwise, default.
System.Boolean
True if the value was found and cast successfully; otherwise, false.
Attempts to get a value for the specified row and column objects, cast to type T.
public bool TryGetValue<T>(TRow? row, TColumn? column, out T? value);T
The expected type of the value.
row TRow
The row object.
column TColumn
The column object.
value T
When this method returns, contains the value if found and cast successfully; otherwise, default.
System.Boolean
True if the value was found and cast successfully; otherwise, false.
Updates an existing column at the specified index.
public TColumn? UpdateColumn(int index, TColumn column, bool tryConvert=true);index System.Int32
The zero-based index of the column to update.
column TColumn
The new column definition.
tryConvert System.Boolean
Whether to attempt conversion of existing row values to the new column type.
TColumn
A clone of the updated column, or null if update failed.
Updates a row at the specified index using column indices and values.
public TRow? UpdateRow(int index, System.Collections.Generic.IDictionary<int,object?>? values);index System.Int32
The zero-based index of the row to update.
values System.Collections.Generic.IDictionary<System.Int32,System.Object>
A dictionary of column indices and their corresponding values.
TRow
The updated row, or null if update failed.
Updates a row at the specified index using column names and values.
public TRow? UpdateRow(int index, System.Collections.Generic.IDictionary<string,object?>? values, System.Func<string?,string?,bool>? func=null);index System.Int32
The zero-based index of the row to update.
values System.Collections.Generic.IDictionary<System.String,System.Object>
A dictionary of column names and their corresponding values.
func System.Func<System.String,System.String,System.Boolean>
An optional custom function to match column names.
TRow
The updated row, or null if update failed.
Updates a row at the specified index using an ordered collection of values.
public TRow? UpdateRow(int index, System.Collections.Generic.IEnumerable<object>? values);index System.Int32
The zero-based index of the row to update.
values System.Collections.Generic.IEnumerable<System.Object>
A sequence of values corresponding to columns in order.
TRow
The updated row, or null if update failed.
Represents a table with columns of type TColumn and rows of type Row.
public class Table<TColumn> : DiGi.Core.IO.Table.Classes.Table<TColumn, DiGi.Core.IO.Table.Classes.Row>
where TColumn : DiGi.Core.IO.Table.Interfaces.IColumnTColumn
The type of the columns in the table.
Inheritance System.Object → DiGi.Core.IO.Table.Classes.Table<TColumn,Row> → Table<TColumn>
Derived
↳ Table
Initializes a new instance of the Table<TColumn> class.
public Table();Initializes a new instance of the Table<TColumn> class with specified columns.
public Table(System.Collections.Generic.IEnumerable<TColumn> columns);columns System.Collections.Generic.IEnumerable<TColumn>
The collection of columns to add to the table.
Creates a new Row for this table.
protected override DiGi.Core.IO.Table.Classes.Row CreateRow(int index, System.Collections.Generic.IDictionary<int,object?>? values=null);index System.Int32
The index to assign to the new row.
values System.Collections.Generic.IDictionary<System.Int32,System.Object>
Optional initial values for the row.
Row
A newly created row instance.
Provides custom JSON serialization and deserialization for tables.
public class TableConverter<UTable,UColumn,URow> : System.Text.Json.Serialization.JsonConverter<UTable>
where UTable : DiGi.Core.IO.Table.Interfaces.ITable<UColumn, URow>, new()
where UColumn : DiGi.Core.IO.Table.Interfaces.IColumn
where URow : DiGi.Core.IO.Table.Interfaces.IRow<URow>UTable
The type of the table.
UColumn
The type of the column.
URow
The type of the row.
Inheritance System.Object → System.Text.Json.Serialization.JsonConverter → System.Text.Json.Serialization.JsonConverter<UTable> → TableConverter<UTable,UColumn,URow>
Reads and deserializes a table object from the provided UTF8 JSON reader.
public override UTable? Read(ref System.Text.Json.Utf8JsonReader utf8JsonReader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions jsonSerializerOptions);utf8JsonReader System.Text.Json.Utf8JsonReader
The UTF8 JSON reader to read from.
typeToConvert System.Type
The type of the object to convert to.
jsonSerializerOptions System.Text.Json.JsonSerializerOptions
The options for JSON deserialization.
UTable
The deserialized table object, or null if the value is null.
Serializes a table object into the provided UTF8 JSON writer.
public override void Write(System.Text.Json.Utf8JsonWriter utf8JsonWriter, UTable table, System.Text.Json.JsonSerializerOptions jsonSerializerOptions);utf8JsonWriter System.Text.Json.Utf8JsonWriter
The UTF8 JSON writer to write to.
table UTable
The table object to serialize.
jsonSerializerOptions System.Text.Json.JsonSerializerOptions
The options for JSON serialization.