DataTableMappingCollection 构造函数

定义

初始化 DataTableMappingCollection 类的新实例。 此新实例为空,即它尚未包含任何 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

适用于