DataRelationCollection 類別

定義

表示這個 DataRelationDataSet 物件集合。Represents the collection of DataRelation objects for this DataSet.

public ref class DataRelationCollection abstract : System::Data::InternalDataCollectionBase
[System.Serializable]
public abstract class DataRelationCollection : System.Data.InternalDataCollectionBase
type DataRelationCollection = class
    inherit InternalDataCollectionBase
Public MustInherit Class DataRelationCollection
Inherits InternalDataCollectionBase
繼承
DataRelationCollection
屬性

備註

物件可讓您在相關的父系/ DataTable子物件之間流覽。 DataRelationCollectionA DataRelationCollection object enables navigation between related parent/child DataTable objects.

您可以建立DataRelationCollection物件,其方式是將DataSet它定義為或的DataTable屬性,而不是直接使用函式。You create a DataRelationCollection object by defining it as a property of either the DataSet or the DataTable, instead of by directly using a constructor. (使用Relations的屬性DataSet ParentRelationsDataTable或的屬性)。(Use the Relations property of the DataSet, or the ParentRelations property of the DataTable.)

若要存取集合,請使用Relations DataSet物件的屬性。To access the collection, use the Relations property of the DataSet object.

一旦集合存在Add,您就可以使用、 ClearRemove等方法來管理它所包含的物件。As soon as the collection exists you can manage the objects it contains by using methods such as Add, Clear, and Remove.

建構函式

DataRelationCollection()

初始化 DataRelationCollection 類別的新執行個體。Initializes a new instance of the DataRelationCollection class.

屬性

Count

取得集合中的項目總數。Gets the total number of elements in a collection.

(繼承來源 InternalDataCollectionBase)
IsReadOnly

取得值,這個值表示 InternalDataCollectionBase 是否為唯讀。Gets a value that indicates whether the InternalDataCollectionBase is read-only.

(繼承來源 InternalDataCollectionBase)
IsSynchronized

取得值,表示 InternalDataCollectionBase 是否同步處理。Gets a value that indicates whether the InternalDataCollectionBase is synchronized.

(繼承來源 InternalDataCollectionBase)
Item[Int32]

取得在指定之索引處的 DataRelation 物件。Gets the DataRelation object at the specified index.

Item[String]

取得根據名稱所指定的 DataRelation 物件。Gets the DataRelation object specified by name.

List

取得集合的項目做為清單。Gets the items of the collection as a list.

(繼承來源 InternalDataCollectionBase)
SyncRoot

取得可以用來同步集合的物件。Gets an object that can be used to synchronize the collection.

(繼承來源 InternalDataCollectionBase)

方法

Add(DataColumn, DataColumn)

使用指定的父資料行和子資料行建立 DataRelation,並將它加入至集合中。Creates a DataRelation with a specified parent and child column, and adds it to the collection.

Add(DataColumn[], DataColumn[])

使用指定的名稱以及父資料行和子資料行來建立 DataRelation,並將它加入至集合中。Creates a DataRelation with the specified parent and child columns, and adds it to the collection.

Add(DataRelation)

DataRelation 加入至 DataRelationCollectionAdds a DataRelation to the DataRelationCollection.

Add(String, DataColumn, DataColumn)

使用指定的名稱以及父資料行和子資料行來建立 DataRelation,並將它加入至集合中。Creates a DataRelation with the specified name, and parent and child columns, and adds it to the collection.

Add(String, DataColumn, DataColumn, Boolean)

使用指定的名稱、父資料行和子資料行,並附根據 createConstraints 參數值的選擇性條件約束,來建立 DataRelation,並將它加入至集合中。Creates a DataRelation with the specified name, parent and child columns, with optional constraints according to the value of the createConstraints parameter, and adds it to the collection.

Add(String, DataColumn[], DataColumn[])

使用指定名稱以及父資料行和子資料行的陣列來建立 DataRelation,並將它加入至集合。Creates a DataRelation with the specified name and arrays of parent and child columns, and adds it to the collection.

Add(String, DataColumn[], DataColumn[], Boolean)

使用指定名稱、父資料行和子資料行的陣列和指定是否要建立條件限制的值來建立 DataRelation,並將它加入至集合。Creates a DataRelation with the specified name, arrays of parent and child columns, and value specifying whether to create a constraint, and adds it to the collection.

AddCore(DataRelation)

在資料表上執行驗證。Performs verification on the table.

AddRange(DataRelation[])

將指定的 DataRelation 陣列元素複製到集合的末端。Copies the elements of the specified DataRelation array to the end of the collection.

CanRemove(DataRelation)

驗證是否可以從集合移除指定的 DataRelationVerifies whether the specified DataRelation can be removed from the collection.

Clear()

清除任何關聯的集合。Clears the collection of any relations.

Contains(String)

驗證集合中是否有具指定名稱 (不區分大小寫) 的 DataRelationVerifies whether a DataRelation with the specific name (case insensitive) exists in the collection.

CopyTo(Array, Int32)

複製目前 InternalDataCollectionBase 的所有項目至一維 Array,開始於指定的 InternalDataCollectionBase 索引。Copies all the elements of the current InternalDataCollectionBase to a one-dimensional Array, starting at the specified InternalDataCollectionBase index.

(繼承來源 InternalDataCollectionBase)
CopyTo(DataRelation[], Int32)

複製 DataRelation 物件的集合,從指定的索引處開始。Copies the collection of DataRelation objects starting at the specified index.

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetDataSet()

此方法支援 .NET Framework 結構而且並非設計直接從程式碼使用。This method supports the .NET Framework infrastructure and is not intended to be used directly from your code.

GetEnumerator()

取得集合的 IEnumeratorGets an IEnumerator for the collection.

(繼承來源 InternalDataCollectionBase)
GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
IndexOf(DataRelation)

取得指定 DataRelation 物件的索引。Gets the index of the specified DataRelation object.

IndexOf(String)

取得根據名稱所指定的 DataRelation 之索引。Gets the index of the DataRelation specified by name.

MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(繼承來源 Object)
OnCollectionChanged(CollectionChangeEventArgs)

引發 CollectionChanged 事件。Raises the CollectionChanged event.

OnCollectionChanging(CollectionChangeEventArgs)

引發 CollectionChanged 事件。Raises the CollectionChanged event.

Remove(DataRelation)

從集合移除指定的關聯。Removes the specified relation from the collection.

Remove(String)

從集合移除具有指定名稱的關聯。Removes the relation with the specified name from the collection.

RemoveAt(Int32)

從集合移除在指定索引處的關聯。Removes the relation at the specified index from the collection.

RemoveCore(DataRelation)

在指定的 DataRelation 物件上執行驗證。Performs a verification on the specified DataRelation object.

ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

事件

CollectionChanged

發生於集合變更時。Occurs when the collection has changed.

擴充方法

Cast<TResult>(IEnumerable)

IEnumerable 的項目轉換成指定的型別。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

啟用查詢的平行化作業。Enables parallelization of a query.

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryableConverts an IEnumerable to an IQueryable.

適用於

執行緒安全性

這種類型對於多執行緒讀取作業而言是安全的。This type is safe for multithreaded read operations. 您必須同步處理任何寫入作業。You must synchronize any write operations.

另請參閱