共用方式為


DataTableMappingCollection 建構函式

定義

初始化 DataTableMappingCollection 類別的新執行個體。 這個新執行個體 (Instance) 是空的,也就是說,它尚未含有任何 DataTableMapping 物件。

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

範例

下列範例會 DataTableMappingCollection建立 、將 物件加入 DataTableMapping 集合中,並顯示對應的源數據表清單。

public void CreateTableMappings()
{
    DataTableMappingCollection mappings =
        new DataTableMappingCollection();
    mappings.Add("Categories","DataCategories");
    mappings.Add("Orders","DataOrders");
    mappings.Add("Products","DataProducts");
    string message = "TableMappings:\n";
    for(int i=0;i < mappings.Count;i++)
    {
        message += i.ToString() + " "
            + mappings[i].ToString() + "\n";
    }
    Console.WriteLine(message);
}
Public Sub CreateTableMappings()
    Dim mappings As New DataTableMappingCollection()
    mappings.Add("Categories", "DataCategories")
    mappings.Add("Orders", "DataOrders")
    mappings.Add("Products", "DataProducts")
    Dim message As String = "TableMappings:" & ControlChars.Cr
    Dim i As Integer
    For i = 0 To mappings.Count - 1
        message &= i.ToString() & " " + mappings(i).ToString() _
           & ControlChars.Cr
    Next i
    Console.WriteLine(message)
End Sub

適用於