IColumnMappingCollection 接口  
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
包含 DataColumnMapping 对象的集合,并由 DataColumnMappingCollection(通常由 .NET 数据提供程序共同使用)实现。
public interface class IColumnMappingCollection : System::Collections::IListpublic interface IColumnMappingCollection : System.Collections.IListtype IColumnMappingCollection = interface
    interface ICollection
    interface IEnumerable
    interface IListtype IColumnMappingCollection = interface
    interface IList
    interface ICollection
    interface IEnumerablePublic Interface IColumnMappingCollection
Implements IList- 派生
- 实现
示例
以下示例使用派生类的实例,DataTableMapping将其Add集合中的ColumnMappings多个 DataColumnMapping 对象,然后显示这些映射的源表的列表。 此示例假定 DataTableMapping 已创建 。
public void ShowColumnMappings()
{
    // ...
    // create tableMapping
    // ...
    tableMapping.ColumnMappings.Add("Category Name","DataCategory");
    tableMapping.ColumnMappings.Add("Description","DataDescription");
    tableMapping.ColumnMappings.Add("Picture","DataPicture");
    Console.WriteLine("Column Mappings");
    for(int i=0;i < tableMapping.ColumnMappings.Count;i++)
    {
        Console.WriteLine("  {0} {1}", i,
            tableMapping.ColumnMappings[i].ToString());
    }
}
Public Sub ShowColumnMappings()
    ' ...
    ' create tableMapping
    ' ...
    tableMapping.ColumnMappings.Add( _
       "Category Name", "DataCategory")
    tableMapping.ColumnMappings.Add( _
       "Description", "DataDescription")
    tableMapping.ColumnMappings.Add( _
       "Picture", "DataPicture")
    Console.WriteLine("Column Mappings:")
    Dim i As Integer
    For i = 0 To tableMapping.ColumnMappings.Count - 1
        Console.WriteLine("  {0} {1}", i, _
           tableMapping.ColumnMappings(i).ToString())
    Next i
End Sub
注解
接口 IColumnMappingCollection 使继承类可以实现 ColumnMapping 集合。 有关详细信息,请参阅 DataAdapter DataTable 和 DataColumn 映射。
应用程序不会直接创建 接口的 IColumnMappingCollection 实例,而是创建继承 的类的 IColumnMappingCollection实例。
继承 IColumnMappingCollection 的类必须实现所有继承的成员,并且通常定义其他成员以添加特定于提供程序的功能。 例如, IColumnMappingCollection 接口定义 RemoveAt 方法。 类反过来 DataTableMappingCollection 会继承此方法,并定义 的两个附加重载 RemoveAt。
实施者说明
从 IColumnMappingCollection 接口继承时,应实现以下构造函数:
| 项 | 描述 | 
|---|---|
| ColumnMappingCollection () | 创建一个空的 ColumnMappingCollection 类。 | 
属性
| Count | 获取 ICollection 中包含的元素数。(继承自 ICollection) | 
| IsFixedSize | 获取一个值,该值指示 IList 是否具有固定大小。(继承自 IList) | 
| IsReadOnly | 获取一个值,该值指示 IList 是否为只读。(继承自 IList) | 
| IsSynchronized | 获取一个值,该值指示是否同步对 ICollection 的访问(线程安全)。(继承自 ICollection) | 
| Item[Int32] | 获取或设置指定索引处的元素。(继承自 IList) | 
| Item[String] | 获取或设置具有指定  | 
| SyncRoot | 获取可用于同步对 ICollection 的访问的对象。(继承自 ICollection) | 
方法
| Add(Object) | 将某项添加到 IList 中。(继承自 IList) | 
| Add(String, String) | 使用源列和 DataSet 列名,将 ColumnMapping 对象添加到 ColumnMapping 集合中。 | 
| Clear() | 从 IList 中移除所有项。(继承自 IList) | 
| Contains(Object) | 确定 IList 是否包含特定值。(继承自 IList) | 
| Contains(String) | 获取一个值,该值指示 DataColumnMappingCollection 是否包含具有指定源列名称的 DataColumnMapping 对象。 | 
| CopyTo(Array, Int32) | 从特定的 ICollection 索引开始,将 Array 的元素复制到一个 Array 中。(继承自 ICollection) | 
| GetByDataSetColumn(String) | 获取具有指定 DataSet 列名的 ColumnMapping 对象。 | 
| GetEnumerator() | 返回循环访问集合的枚举数。(继承自 IEnumerable) | 
| IndexOf(Object) | 确定 IList 中特定项的索引。(继承自 IList) | 
| IndexOf(String) | 获取具有指定源列名称的 DataColumnMapping 对象的位置。 该名称区分大小写。 | 
| Insert(Int32, Object) | 在 IList 中的指定索引处插入一个项。(继承自 IList) | 
| Remove(Object) | 从 IList 中移除特定对象的第一个匹配项。(继承自 IList) | 
| RemoveAt(Int32) | 移除位于指定索引处的 IList 项。(继承自 IList) | 
| RemoveAt(String) | 从集合中移除具有指定 SourceColumn 名称的 IColumnMapping 对象。 | 
扩展方法
| Cast<TResult>(IEnumerable) | 将 IEnumerable 的元素强制转换为指定的类型。 | 
| OfType<TResult>(IEnumerable) | 根据指定类型筛选 IEnumerable 的元素。 | 
| AsParallel(IEnumerable) | 启用查询的并行化。 | 
| AsQueryable(IEnumerable) | 将 IEnumerable 转换为 IQueryable。 |