ITableMapping.ColumnMappings 属性

定义

获取 DataTable 的派生 DataColumnMappingCollectionGets the derived DataColumnMappingCollection for the DataTable.

public:
 property System::Data::IColumnMappingCollection ^ ColumnMappings { System::Data::IColumnMappingCollection ^ get(); };
public System.Data.IColumnMappingCollection ColumnMappings { get; }
member this.ColumnMappings : System.Data.IColumnMappingCollection
Public ReadOnly Property ColumnMappings As IColumnMappingCollection

属性值

IColumnMappingCollection

数据列映射集合。A collection of data column mappings.

示例

下面的示例创建派生类的实例, DataTableMapping 并设置其一些属性,并将其复制 ColumnMappings 到数组中。The following example creates an instance of the derived class, DataTableMapping, sets some of its properties, and copies its ColumnMappings to an array. 本示例假定已 DataColumnMappingCollection 创建了。This example assumes that a DataColumnMappingCollection has been created.

public void CreateDataTableMapping()
{
    // ...
    // create mappings
    // ...
    DataColumnMapping[] columns = {};
    // Copy mappings to array
    mappings.CopyTo(columns, 0);
    DataTableMapping mapping =
        new DataTableMapping("Categories", "DataCategories", columns);
}
Public Sub CreateDataTableMapping()
    ' ...
    ' create mappings
    ' ...
    Dim columns() As DataColumnMapping
    ' Copy mappings to array
    mappings.CopyTo(columns, 0)
    Dim mapping As New DataTableMapping _
       ("Categories", "DataCategories", columns)
End Sub

适用于