共用方式為


DataTableMappingCollection.Count 屬性

定義

取得集合中 DataTableMapping 物件的數目。

public:
 property int Count { int get(); };
[System.ComponentModel.Browsable(false)]
public int Count { get; }
[System.ComponentModel.Browsable(false)]
[System.Data.DataSysDescription("DataTableMappings_Count")]
public int Count { get; }
[<System.ComponentModel.Browsable(false)>]
member this.Count : int
[<System.ComponentModel.Browsable(false)>]
[<System.Data.DataSysDescription("DataTableMappings_Count")>]
member this.Count : int
Public ReadOnly Property Count As Integer

屬性值

集合中 DataTableMapping 物件的數目。

實作

屬性

範例

下列範例會 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

適用於