次の方法で共有


DataColumnMappingCollection.Item プロパティ (Int32)

指定したインデックスの位置にある DataColumnMapping オブジェクトを取得または設定します。

[C#] C# では、このプロパティは DataColumnMappingCollection クラスのインデクサになります。

Overloads Public Default Property Item( _
   ByVal index As Integer _) As DataColumnMapping
[C#]
public DataColumnMapping this[intindex] {get; set;}
[C++]
public: __property DataColumnMapping* get_Item(intindex);public: __property void set_Item(intindex,   DataColumnMapping*);
[JScript]
returnValue = DataColumnMappingCollectionObject.Item(index);DataColumnMappingCollectionObject.Item(index) = returnValue;またはreturnValue = DataColumnMappingCollectionObject(index);DataColumnMappingCollectionObject(index) = returnValue;

[JScript] JScript では、この型で定義されている既定のインデックス プロパティを使用することができます。しかし、独自のインデックス プロパティを明示的に定義することはできません。ただし、このクラスの expando 属性を指定すると、既定のインデックス プロパティが提供されます。提供されるインデックス プロパティの型は Object 型であり、インデックス型は String になります。

引数 [JScript]

  • index
    検索する DataColumnMapping オブジェクトの、0 から始まるインデックス番号。

パラメータ [Visual Basic, C#, C++]

  • index
    検索する DataColumnMapping オブジェクトの、0 から始まるインデックス番号。

プロパティ値

指定したインデックスの位置にある DataColumnMapping オブジェクト。

使用例

[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 ファミリ

参照

DataColumnMappingCollection クラス | DataColumnMappingCollection メンバ | System.Data.Common 名前空間 | DataColumnMappingCollection.Item オーバーロードの一覧