DataRowCollection.Item[Int32] 속성

정의

지정된 인덱스의 행을 가져옵니다.

public:
 property System::Data::DataRow ^ default[int] { System::Data::DataRow ^ get(int index); };
public System.Data.DataRow this[int index] { get; }
member this.Item(int) : System.Data.DataRow
Default Public ReadOnly Property Item(index As Integer) As DataRow

매개 변수

index
Int32

반환할 행의 인덱스(0부터 시작)입니다.

속성 값

지정된 DataRow입니다.

예외

인덱스 값이 컬렉션의 항목 수보다 큰 경우

예제

다음 예제에서는 각 행의 열 1 값을 에 인쇄합니다 DataRowCollection.

private void PrintRows(DataTable table)
{
    // Print the CompanyName column for every row using the index.
    for(int i = 0; i < table.Rows.Count; i++)
    {
        Console.WriteLine(table.Rows[i]["CompanyName"]);
    }
}
Private Sub PrintRows(table As DataTable)
     ' Print the first column for every row using the index.
     Dim i As Integer
     For i = 0 To table.Rows.Count - 1
         Console.WriteLine(table.Rows(i)(0))
     Next i
End Sub

설명

메서드를 Contains 사용하여 행의 키 열에 특정 값이 있는지 여부를 확인합니다.

적용 대상

추가 정보