DataRowCollection 클래스

정의

DataTable에 대한 행 컬렉션을 나타냅니다.

public ref class DataRowCollection sealed : System::Data::InternalDataCollectionBase
public ref class DataRowCollection : System::Data::InternalDataCollectionBase
public sealed class DataRowCollection : System.Data.InternalDataCollectionBase
[System.Serializable]
public class DataRowCollection : System.Data.InternalDataCollectionBase
type DataRowCollection = class
    inherit InternalDataCollectionBase
[<System.Serializable>]
type DataRowCollection = class
    inherit InternalDataCollectionBase
Public NotInheritable Class DataRowCollection
Inherits InternalDataCollectionBase
Public Class DataRowCollection
Inherits InternalDataCollectionBase
상속
특성

예제

이 섹션의 첫 번째 예제에서는 의 모든 행에 대해 열 1의 값을 인쇄합니다 DataRowCollection. 두 번째 예제에서는 메서드를 사용하여 만든 새 행을 NewRowDataRowCollection추가합니다.

private void ShowRows(DataTable table)
{
    // Print the number of rows in the collection.
    Console.WriteLine(table.Rows.Count);
    // Print the value of columns 1 in each row
    foreach(DataRow row in table.Rows)
    {
        Console.WriteLine(row[1]);
    }
}

private void AddRow(DataTable table)
{
    DataRowCollection rowCollection = table.Rows;
    // Instantiate a new row using the NewRow method.

    DataRow newRow = table.NewRow();
    // Insert code to fill the row with values.

    // Add the row to the DataRowCollection.
    table.Rows.Add(newRow);
}
Private Sub ShowRows(Byval table As DataTable)
    ' Print the number of rows in the collection.
    Console.WriteLine(table.Rows.Count)

    Dim row  As DataRow
    ' Print the value of columns 1 in each row
    For Each row In table.Rows
        Console.WriteLine(row(1))
    Next
End Sub
 
Private Sub AddRow(ByVal table As DataTable)
    ' Instantiate a new row using the NewRow method.
    Dim newRow As DataRow = table.NewRow()
    ' Insert code to fill the row with values.

    ' Add the row to the DataRowCollection.
    table.Rows.Add(newRow)
End Sub

설명

DataRowCollection 의 주요 구성 요소입니다 DataTable. 는 DataColumnCollection 테이블의 스키마를 정의하지만 에 DataRowCollection 테이블의 실제 데이터가 포함됩니다. 여기서 의 각 DataRowDataRowCollection 은 단일 행을 나타냅니다.

및 메서드를 Add 호출하여 에서 개체를 삽입하고 삭제 DataRowDataRowCollectionRemove 있습니다. 메서드를 Find 호출하여 기본 키 열에 특정 값이 포함된 개체를 검색 DataRow 하고 Contains 메서드를 호출하여 단일 단어 또는 구에 대한 문자 기반 데이터를 검색할 수도 있습니다.

정렬 또는 필터링DataRowCollection과 같은 다른 작업의 경우 연결된 DataTable의 에 메서드를 DataRowCollection사용합니다.

속성

Count

이 컬렉션에 있는 DataRow 개체의 총 수를 가져옵니다.

Count

컬렉션에 있는 요소의 총수를 가져옵니다.

(다음에서 상속됨 InternalDataCollectionBase)
IsReadOnly

InternalDataCollectionBase이 읽기 전용인지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 InternalDataCollectionBase)
IsSynchronized

InternalDataCollectionBase이 동기화되었는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 InternalDataCollectionBase)
Item[Int32]

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

List

DataTable에 대한 행 컬렉션을 나타냅니다.

List

컬렉션의 항목을 목록으로 가져옵니다.

(다음에서 상속됨 InternalDataCollectionBase)
SyncRoot

컬렉션을 동기화하는 데 사용할 수 있는 개체를 가져옵니다.

(다음에서 상속됨 InternalDataCollectionBase)

메서드

Add(DataRow)

지정된 DataRowDataRowCollection 개체에 추가합니다.

Add(Object[])

지정한 값을 사용하여 행을 만들고 그 행을 DataRowCollection에 추가합니다.

Clear()

모든 행의 컬렉션을 지웁니다.

Contains(Object)

컬렉션에 있는 모든 행의 기본 키에 지정한 값이 있는지 여부를 나타내는 값을 가져옵니다.

Contains(Object[])

컬렉션에 있는 모든 행의 기본 키 열에 개체 배열에 지정한 값이 있는지 여부를 나타내는 값을 가져옵니다.

CopyTo(Array, Int32)

컬렉션의 모든 DataRow 개체를 지정된 배열의 지정된 대상 배열 인덱스에서 시작하는 위치에 복사합니다.

CopyTo(Array, Int32)

지정된 InternalDataCollectionBase 인덱스에서 시작하여 현재 Array의 모든 요소를 1차원 InternalDataCollectionBase에 복사합니다.

(다음에서 상속됨 InternalDataCollectionBase)
CopyTo(DataRow[], Int32)

컬렉션의 모든 DataRow 개체를 지정된 배열의 지정된 대상 배열 인덱스에서 시작하는 위치에 복사합니다.

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
Find(Object)

기본 키 값으로 지정한 행을 가져옵니다.

Find(Object[])

지정한 기본 키 값이 있는 행을 가져옵니다.

GetEnumerator()

이 컬렉션의 IEnumerator를 가져옵니다.

GetEnumerator()

컬렉션에 대한 IEnumerator를 가져옵니다.

(다음에서 상속됨 InternalDataCollectionBase)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
IndexOf(DataRow)

지정된 DataRow 개체의 인덱스를 가져옵니다.

InsertAt(DataRow, Int32)

컬렉션의 지정한 위치에 새 행을 삽입합니다.

MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
Remove(DataRow)

지정된 DataRow를 컬렉션에서 제거합니다.

RemoveAt(Int32)

컬렉션에서 지정된 인덱스의 행을 제거합니다.

ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

확장 메서드

Cast<TResult>(IEnumerable)

IEnumerable의 요소를 지정된 형식으로 캐스팅합니다.

OfType<TResult>(IEnumerable)

지정된 형식에 따라 IEnumerable의 요소를 필터링합니다.

AsParallel(IEnumerable)

쿼리를 병렬화할 수 있도록 합니다.

AsQueryable(IEnumerable)

IEnumerableIQueryable로 변환합니다.

적용 대상

스레드 보안

이 형식은 다중 스레드 읽기 작업에 안전합니다. 모든 쓰기 작업을 동기화해야 합니다.

추가 정보