IColumnMappingCollection IColumnMappingCollection IColumnMappingCollection IColumnMappingCollection Interface

定義

包含 DataColumnMapping 物件的集合,並且是由 DataColumnMappingCollection 所實作,這是由 .NET Framework 資料提供者 (Data Provider) 所共同使用。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,以AddDataColumnMapping物件新增至其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 和 DataColumn 對應For more information, see DataAdapter DataTable and DataColumn Mappings.

應用程式不會建立的執行個體IColumnMappingCollection介面直接,但建立繼承的類別的執行個體IColumnMappingCollectionAn 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類別會繼承這個方法,並定義兩個額外的多載的RemoveAtIn 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()ColumnMappingCollection() 建立空的 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)

將項目加入至 IListAdds 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 的項目複製到 ArrayCopies 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)

將項目插入位於指定索引的 IListInserts 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)

從集合中移除具有指定 IColumnMapping 名稱的 SourceColumn 物件。Removes the IColumnMapping object with the specified SourceColumn name from the collection.

Extension Methods

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)

將轉換IEnumerableIQueryableConverts an IEnumerable to an IQueryable.

適用於