IColumnMappingCollection 接口

定义

包含 DataColumnMapping 对象的集合,并由 DataColumnMappingCollection(通常由 .NET 数据提供程序共同使用)实现。

public interface class IColumnMappingCollection : System::Collections::IList
public interface IColumnMappingCollection : System.Collections.IList
type IColumnMappingCollection = interface
    interface ICollection
    interface IEnumerable
    interface IList
type IColumnMappingCollection = interface
    interface IList
    interface ICollection
    interface IEnumerable
Public Interface IColumnMappingCollection
Implements IList
派生
实现

示例

下面的示例使用派生类的一个实例, DataTableMapping将其集合中的 Add 多个 DataColumnMapping 对象 ColumnMappings ,然后显示这些映射的源表的列表。 此示例假定已创建 a 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]

获取或设置具有指定 SourceColumn 名称的 IColumnMapping 对象。

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

适用于