IColumnMappingCollection 介面

定義

包含 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, 將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 和 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()ColumnMappingCollection() 建立空的 ColumnMappingCollection 類別。Creates an empty ColumnMappingCollection class.

屬性

Count

取得 ICollection 中所包含的項目數。Gets the number of elements contained in the ICollection.

(繼承來源 ICollection)
IsFixedSize

取得值,指出 IList 是否有固定的大小。Gets a value indicating whether the IList has a fixed size.

(繼承來源 IList)
IsReadOnly

取得值,指出 IList 是否唯讀。Gets a value indicating whether the IList is read-only.

(繼承來源 IList)
IsSynchronized

取得值,這個值表示對 ICollection 的存取是否同步 (安全執行緒)。Gets a value indicating whether access to the ICollection is synchronized (thread safe).

(繼承來源 ICollection)
Item[Int32]

在指定的索引位置上取得或設定項目。Gets or sets the element at the specified index.

(繼承來源 IList)
Item[String]

取得或設定具有指定 SourceColumn 名稱的 IColumnMapping 物件。Gets or sets the IColumnMapping object with the specified SourceColumn name.

SyncRoot

取得可用以同步存取 ICollection 的物件。Gets an object that can be used to synchronize access to the ICollection.

(繼承來源 ICollection)

方法

Add(Object)

將項目加入至 IListAdds an item to the IList.

(繼承來源 IList)
Add(String, String)

使用來源資料行和 DataSet 資料行名稱來將 ColumnMapping 物件加入至 ColumnMapping 集合。Adds a ColumnMapping object to the ColumnMapping collection using the source column and DataSet column names.

Clear()

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

(繼承來源 IList)
Contains(Object)

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

(繼承來源 IList)
Contains(String)

取得值,表示 DataColumnMappingCollection 是否包含具有指定來源資料行名稱的 DataColumnMapping 物件。Gets a value indicating whether the DataColumnMappingCollection contains a DataColumnMapping object with the specified source column name.

CopyTo(Array, Int32)

從特定的 ICollection 索引開始,將 Array 的項目複製到 ArrayCopies the elements of the ICollection to an Array, starting at a particular Array index.

(繼承來源 ICollection)
GetByDataSetColumn(String)

取得具有指定 DataSet 資料行名稱的 ColumnMapping 物件。Gets the ColumnMapping object with the specified DataSet column name.

GetEnumerator()

傳回逐一查看集合的列舉值。Returns an enumerator that iterates through a collection.

(繼承來源 IEnumerable)
IndexOf(Object)

判斷 IList 中指定項目的索引。Determines the index of a specific item in the IList.

(繼承來源 IList)
IndexOf(String)

取得具有指定來源資料行名稱的 DataColumnMapping 物件位置。Gets the location of the DataColumnMapping object with the specified source column name. 名稱區分大小寫。The name is case-sensitive.

Insert(Int32, Object)

將項目插入位於指定索引的 IListInserts an item to the IList at the specified index.

(繼承來源 IList)
Remove(Object)

IList 移除特定物件之第一個符合的元素。Removes the first occurrence of a specific object from the IList.

(繼承來源 IList)
RemoveAt(Int32)

移除在指定索引處的 IList 項目。Removes the IList item at the specified index.

(繼承來源 IList)
RemoveAt(String)

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

擴充方法

Cast<TResult>(IEnumerable)

IEnumerable 的項目轉換成指定的型別。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

啟用查詢的平行化作業。Enables parallelization of a query.

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryableConverts an IEnumerable to an IQueryable.

適用於