IColumnMappingCollection IColumnMappingCollection IColumnMappingCollection IColumnMappingCollection Interface

定义

包含一个 DataColumnMapping 对象的集合,并由 DataColumnMappingCollection 实现,这是由 .NET Framework 数据提供程序通常使用的方法。Contains a collection of DataColumnMapping objects, and is implemented by the DataColumnMappingCollection, which is used in common by .NET Framework data providers.

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

示例

下面的示例使用派生DataTableMapping类的实例, 指向Add多个DataColumnMapping对象ColumnMappings的集合, 然后显示这些映射的源表的列表。The following example uses an instance of the derived class, DataTableMapping, to Add several DataColumnMapping objects to its ColumnMappings collection, and then displays a list of those mapped source tables. 本示例假定已创建DataTableMapping了。This example assumes that a DataTableMapping has already been created.


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 集合。The IColumnMappingCollection interface enables an inheriting class to implement a ColumnMapping collection. 有关详细信息, 请参阅DataAdapter DataTable And DataColumn 映射For more information, see DataAdapter DataTable and DataColumn Mappings.

应用程序不会直接创建IColumnMappingCollection接口的实例, 而是创建继承IColumnMappingCollection的类的实例。An application does not create an instance of the IColumnMappingCollection interface directly, but creates an instance of a class that inherits IColumnMappingCollection.

继承IColumnMappingCollection的类必须实现所有继承成员, 并且通常定义其他成员来添加特定于提供程序的功能。Classes that inherit IColumnMappingCollection must implement all inherited members, and typically define additional members to add provider-specific functionality. 例如, IColumnMappingCollection接口RemoveAt定义方法。For example, the IColumnMappingCollection interface defines the RemoveAt method. 进而, DataTableMappingCollection该类继承了此方法, 并定义了的RemoveAt两个其他重载。In turn, the DataTableMappingCollection class inherits this method, and defines two additional overloads of RemoveAt.

实施者说明

IColumnMappingCollection接口继承时, 应实现以下构造函数:When you inherit from the IColumnMappingCollection interface, you should implement the following constructor:

Item 说明Description
采用 ()ColumnMappingCollection() 创建一个空的采用类。Creates an empty ColumnMappingCollection class.

属性

Count Count Count Count

获取 ICollection 中包含的元素数。Gets the number of elements contained in the ICollection.

(Inherited from ICollection)
IsFixedSize IsFixedSize IsFixedSize IsFixedSize

获取一个值,该值指示 IList 是否具有固定大小。Gets a value indicating whether the IList has a fixed size.

(Inherited from IList)
IsReadOnly IsReadOnly IsReadOnly IsReadOnly

获取一个值,该值指示 IList 是否为只读。Gets a value indicating whether the IList is read-only.

(Inherited from IList)
IsSynchronized IsSynchronized IsSynchronized IsSynchronized

获取一个值,该值指示是否同步对 ICollection 的访问(线程安全)。Gets a value indicating whether access to the ICollection is synchronized (thread safe).

(Inherited from ICollection)
Item[Int32] Item[Int32] Item[Int32] Item[Int32]

获取或设置指定索引处的元素。Gets or sets the element at the specified index.

(Inherited from IList)
Item[String] Item[String] Item[String] Item[String]

获取或设置具有指定 SourceColumn 名称的 IColumnMapping 对象。Gets or sets the IColumnMapping object with the specified SourceColumn name.

SyncRoot SyncRoot SyncRoot SyncRoot

获取可用于同步对 ICollection 的访问的对象。Gets an object that can be used to synchronize access to the ICollection.

(Inherited from ICollection)

方法

Add(Object) Add(Object) Add(Object) Add(Object)

将某项添加到 IList 中。Adds an item to the IList.

(Inherited from IList)
Add(String, String) Add(String, String) Add(String, String) Add(String, String)

使用源列和 DataSet 列名,将 ColumnMapping 对象添加到 ColumnMapping 集合中。Adds a ColumnMapping object to the ColumnMapping collection using the source column and DataSet column names.

Clear() Clear() Clear() Clear()

IList 中移除所有项。Removes all items from the IList.

(Inherited from IList)
Contains(Object) Contains(Object) Contains(Object) Contains(Object)

确定 IList 是否包含特定值。Determines whether the IList contains a specific value.

(Inherited from IList)
Contains(String) Contains(String) Contains(String) Contains(String)

获取一个值,该值指示 DataColumnMappingCollection 是否包含具有指定源列名称的 DataColumnMapping 对象。Gets a value indicating whether the DataColumnMappingCollection contains a DataColumnMapping object with the specified source column name.

CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32)

从特定的 ICollection 索引开始,将 Array 的元素复制到一个 Array 中。Copies the elements of the ICollection to an Array, starting at a particular Array index.

(Inherited from ICollection)
GetByDataSetColumn(String) GetByDataSetColumn(String) GetByDataSetColumn(String) GetByDataSetColumn(String)

获取具有指定 DataSet 列名的 ColumnMapping 对象。Gets the ColumnMapping object with the specified DataSet column name.

GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

返回循环访问集合的枚举数。Returns an enumerator that iterates through a collection.

(Inherited from IEnumerable)
IndexOf(Object) IndexOf(Object) IndexOf(Object) IndexOf(Object)

确定 IList 中特定项的索引。Determines the index of a specific item in the IList.

(Inherited from IList)
IndexOf(String) IndexOf(String) IndexOf(String) IndexOf(String)

获取具有指定源列名称的 DataColumnMapping 对象的位置。Gets the location of the DataColumnMapping object with the specified source column name. 该名称区分大小写。The name is case-sensitive.

Insert(Int32, Object) Insert(Int32, Object) Insert(Int32, Object) Insert(Int32, Object)

IList 中的指定索引处插入一个项。Inserts an item to the IList at the specified index.

(Inherited from IList)
Remove(Object) Remove(Object) Remove(Object) Remove(Object)

IList 中移除特定对象的第一个匹配项。Removes the first occurrence of a specific object from the IList.

(Inherited from IList)
RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32)

移除位于指定索引处的 IList 项。Removes the IList item at the specified index.

(Inherited from IList)
RemoveAt(String) RemoveAt(String) RemoveAt(String) RemoveAt(String)

从集合中移除具有指定 SourceColumn 名称的 IColumnMapping 对象。Removes the IColumnMapping object with the specified SourceColumn name from the collection.

扩展方法

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

启用查询的并行化。Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

适用于