DataColumnMappingCollection.IndexOfDataSetColumn(String) Method

Definition

Gets the location of the specified DataColumnMapping with the given DataSet column name.

public int IndexOfDataSetColumn (string? dataSetColumn);
public int IndexOfDataSetColumn (string dataSetColumn);

Parameters

dataSetColumn
String

The name, which is not case-sensitive, of the data set column to find.

Returns

The zero-based location of the specified DataColumnMapping with the given DataSet column name, or -1 if the DataColumnMapping object does not exist in the collection.

Examples

The following example searches for a DataColumnMapping within the collection. If the object exists, it is returned. The example assumes that a DataColumnMappingCollection collection and a DataColumnMapping object have been created.

public void FindDataColumnMapping()
{
    // ...
    // create mappings and mapping
    // ...
    if (mappings.IndexOfDataSetColumn("datadescription") != -1)
        mapping = mappings.GetByDataSetColumn("datadescription");
}

Applies to

Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

See also