Item[string] Indexer

Overview

Returns column metadata by its column name. This indexer is intended for scenarios where the column is required (for example, when building a search form or validating a business rule against a known schema). If the column does not exist, the indexer throws to fail fast.

Namespace and Assembly

Namespace: PocoDataSet.Data
Assembly: PocoDataSet.Data.dll

Declaration

/// <summary>
/// Gets column metadata by column name.
/// </summary>
/// <param name="columnName">Column name.</param>
/// <returns>Column metadata.</returns>
/// <exception cref="System.Collections.Generic.KeyNotFoundException">Thrown when the column does not exist.</exception>
public IColumnMetadata this[string columnName]
{
    get;
}

Usage Example

// 1. Create an empty data set and a table
IDataSet dataSet = DataSetFactory.CreateDataSet();
IDataTable employeeDataTable = dataSet.AddNewTable("Employee");
employeeDataTable.AddColumn("Id", DataTypeNames.INT32);
employeeDataTable.AddColumn("FirstName", DataTypeNames.STRING);
employeeDataTable.AddColumn("LastName", DataTypeNames.STRING);

// 2. Retrieve column metadata
IColumnMetadata firstNameColumnMetadata = employeeDataTable["FirstName"];

 

Table of Content POCO DataSet API References POCO DataSet Types DataTable Members

 


Business Process Programming in .Net
© 2004–2026 Laskarzhevsky Software Inc.
Unless otherwise noted, the content of this website is licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).
Code examples are provided under the MIT License.
You are free to share and adapt the material provided that appropriate credit is given and any modifications are clearly indicated.
The information provided on this website is for educational purposes only.
The author and publisher make no warranties regarding the completeness or suitability of the information and are not responsible for any damages resulting from its use.