DataColumnMappingCollection.Count Property

 

Gets the number of DataColumnMapping objects in the collection.

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

[BrowsableAttribute(false)]
public int Count { get; }

Property Value

Type: System.Int32

The number of items in the collection.

The following example creates a DataColumnMappingCollection collection, adds DataColumnMapping objects to the collection, and displays a list of the mapped source columns.

public void CreateColumnMappings() 
{
    DataColumnMappingCollection mappings = 
        new DataColumnMappingCollection();
    mappings.Add("Category Name","DataCategory");
    mappings.Add("Description","DataDescription");
    mappings.Add("Picture","DataPicture");
    string message = "ColumnMappings:\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: