共用方式為


DataColumnMappingCollection 建構函式

定義

建立空的 DataColumnMappingCollection

public:
 DataColumnMappingCollection();
public DataColumnMappingCollection ();
Public Sub New ()

範例

下列範例會 DataColumnMappingCollection 建立集合、將 物件加入 DataColumnMapping 至集合,並顯示對應的源數據行清單。

public void CreateColumnMappings()
{
    DataColumnMappingCollection mappings =
        new DataColumnMappingCollection();
    mappings.Add("Category Name","DataCategory");
    mappings.Add("Description","DataDescription");
    mappings.Add("Picture","DataPicture");
    string myMessage = "ColumnMappings:\n";
    for(int i=0;i < mappings.Count;i++)
    {
        myMessage += i.ToString() + " "
            + mappings[i].ToString() + "\n";
    }
    Console.WriteLine(myMessage);
}
Public Sub CreateColumnMappings()
    Dim mappings As New DataColumnMappingCollection()
    mappings.Add("Category Name", "DataCategory")
    mappings.Add("Description", "DataDescription")
    mappings.Add("Picture", "DataPicture")
    Dim myMessage As String = "ColumnMappings:" + ControlChars.Cr
    Dim i As Integer
    For i = 0 To mappings.Count - 1
        myMessage += i.ToString() + " " + mappings(i).ToString() _
           + ControlChars.Cr
    Next i
    Console.WriteLine(myMessage)
End Sub

適用於

另請參閱