次の方法で共有


DataColumnMappingCollection.Count プロパティ

コレクション内の DataColumnMapping オブジェクトの数を取得します。

Public Overridable ReadOnly Property Count As Integer  Implements _   ICollection.Count
[C#]
public virtual int Count {get;}
[C++]
public: __property virtual int get_Count();
[JScript]
public function get Count() : int;

プロパティ値

コレクション内の項目数。

実装

ICollection.Count

使用例

[Visual Basic, C#, C++] DataColumnMappingCollection コレクションを作成し、 DataColumnMapping オブジェクトをコレクションに追加して、割り当てられたソース列の一覧を表示する例を次に示します。

 
Public Sub CreateColumnMappings()
    Dim myColumnMappings As New DataColumnMappingCollection()
    myColumnMappings.Add("Category Name", "DataCategory")
    myColumnMappings.Add("Description", "DataDescription")
    myColumnMappings.Add("Picture", "DataPicture")
    Dim myMessage As String = "ColumnMappings:" + ControlChars.Cr
    Dim i As Integer
    For i = 0 To myColumnMappings.Count - 1
        myMessage += i.ToString() + " " + myColumnMappings(i).ToString() _
           + ControlChars.Cr
    Next i
    MessageBox.Show(myMessage)
End Sub

[C#] 
public void CreateColumnMappings() {
   DataColumnMappingCollection myColumnMappings = new DataColumnMappingCollection();
   myColumnMappings.Add("Category Name","DataCategory");
   myColumnMappings.Add("Description","DataDescription");
   myColumnMappings.Add("Picture","DataPicture");
   string myMessage = "ColumnMappings:\n";
   for(int i=0;i < myColumnMappings.Count;i++)
   {
      myMessage += i.ToString() + " " + myColumnMappings[i].ToString() + "\n";
   }
   MessageBox.Show(myMessage);
}

[C++] 
void CreateColumnMappings() {
   DataColumnMappingCollection* myColumnMappings = new DataColumnMappingCollection;
   myColumnMappings->Add(S"Category Name",S"DataCategory");
   myColumnMappings->Add(S"Description",S"DataDescription");
   myColumnMappings->Add(S"Picture",S"DataPicture");
   String* myMessage = S"ColumnMappings:\n";
   for(int i=0;i < myColumnMappings->Count;i++)
   {
       String::Concat( myMessage, __box(i)->ToString(), S" ", myColumnMappings->Item[i]->ToString(), S"\n" );
   }
   MessageBox::Show(myMessage);
}

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET

参照

DataColumnMappingCollection クラス | DataColumnMappingCollection メンバ | System.Data.Common 名前空間