DataTableMappingCollection.Item Property (Int32)

 

Gets or sets the DataTableMapping object at the specified index.

Namespace:   System.Data.Common
Assembly:  System.Data (in System.Data.dll)

[BrowsableAttribute(false)]
public DataTableMapping this[
	int index
] { get; set; }

Parameters

index
Type: System.Int32

The zero-based index of the DataTableMapping object to return.

Property Value

Type: System.Data.Common.DataTableMapping

The DataTableMapping object at the specified index.

The following example creates a DataTableMappingCollection collection, adds DataTableMapping objects to the collection, and displays a list of the mapped source tables.

public void CreateTableMappings() 
{
    DataTableMappingCollection mappings = 
        new DataTableMappingCollection();
    mappings.Add("Categories","DataCategories");
    mappings.Add("Orders","DataOrders");
    mappings.Add("Products","DataProducts");
    string message = "TableMappings:\n";
    for(int i=0;i < mappings.Count;i++)
    {
        message += i.ToString() + " " 
            + mappings[i].ToString() + "\n";
    }
    Console.WriteLine(message);
}

.NET Framework
Available since 1.1
Return to top
Show: