PropertyCollection 類別

定義

表示可以加入至 DataColumnDataSetDataTable 的屬性集合。

public ref class PropertyCollection : System::Collections::Hashtable
public ref class PropertyCollection : System::Collections::Hashtable, ICloneable
public class PropertyCollection : System.Collections.Hashtable
public class PropertyCollection : System.Collections.Hashtable, ICloneable
[System.Serializable]
public class PropertyCollection : System.Collections.Hashtable
type PropertyCollection = class
    inherit Hashtable
    interface ICloneable
type PropertyCollection = class
    inherit Hashtable
[<System.Serializable>]
type PropertyCollection = class
    inherit Hashtable
Public Class PropertyCollection
Inherits Hashtable
Public Class PropertyCollection
Inherits Hashtable
Implements ICloneable
繼承
PropertyCollection
屬性
實作

範例

下列範例會建立 的時間戳值, DataTable 並將其新增至 PropertyCollection

private void AddTimeStamp()
{
    //Create a new DataTable.
    DataTable table = new DataTable("NewTable");

    //Get its PropertyCollection.
    PropertyCollection properties = table.ExtendedProperties;

    //Add a timestamp value to the PropertyCollection.
    properties.Add("TimeStamp", DateTime.Now);

    // Print the timestamp.
    Console.WriteLine(properties["TimeStamp"]);
}
Private Sub AddTimeStamp()
    'Create a new DataTable.
    Dim table As New DataTable("NewTable")

    'Get its PropertyCollection.
    Dim properties As PropertyCollection = table.ExtendedProperties

    'Add a timestamp value to the PropertyCollection.
    properties.Add("TimeStamp", DateTime.Now)

    'Print the timestamp.
    Console.WriteLine(properties("TimeStamp"))
End Sub

備註

PropertyCollection可以透過 ExtendedPropertiesDataSetDataTable 類別的DataColumn屬性來存取 。

透過將自訂屬性新增至 DataColumnDataSetDataTable 物件 PropertyCollection。 例如,您可能想要儲存物件建立的時間,以便稍後比較另一個物件。

建構函式

PropertyCollection()

初始化 PropertyCollection 類別的新執行個體。

PropertyCollection(SerializationInfo, StreamingContext)
已淘汰.

初始化 PropertyCollection 類別的新執行個體。

屬性

comparer
已淘汰.
已淘汰.

取得或設定 IComparer 所使用的 Hashtable

(繼承來源 Hashtable)
Count

取得 Hashtable 中所包含的索引鍵/值組數目。

(繼承來源 Hashtable)
EqualityComparer

取得 IEqualityComparer 所使用的 Hashtable

(繼承來源 Hashtable)
hcp
已淘汰.
已淘汰.

取得或設定可以分配雜湊程式碼的物件。

(繼承來源 Hashtable)
IsFixedSize

取得值,指出 Hashtable 是否有固定的大小。

(繼承來源 Hashtable)
IsReadOnly

取得值,指出 Hashtable 是否唯讀。

(繼承來源 Hashtable)
IsSynchronized

取得值,這個值表示對 Hashtable 的存取是否同步 (安全執行緒)。

(繼承來源 Hashtable)
Item[Object]

取得或設定與指定之索引鍵相關聯的值。

(繼承來源 Hashtable)
Keys

取得含有 ICollection 中的索引鍵的 Hashtable

(繼承來源 Hashtable)
SyncRoot

取得可用以同步存取 Hashtable 的物件。

(繼承來源 Hashtable)
Values

取得 ICollection,包含 Hashtable 中的值。

(繼承來源 Hashtable)

方法

Add(Object, Object)

將有指定索引鍵和數值的項目加入 Hashtable

(繼承來源 Hashtable)
Clear()

移除 Hashtable 中的所有項目。

(繼承來源 Hashtable)
Clone()

建立 PropertyCollection 物件的淺層複製 (Shallow Copy)。

Clone()

建立 Hashtable 的淺層複本。

(繼承來源 Hashtable)
Contains(Object)

判斷 Hashtable 是否包含特定索引鍵。

(繼承來源 Hashtable)
ContainsKey(Object)

判斷 Hashtable 是否包含特定索引鍵。

(繼承來源 Hashtable)
ContainsValue(Object)

判斷 Hashtable 是否包含特定值。

(繼承來源 Hashtable)
CopyTo(Array, Int32)

Hashtable 元素複製到指定索引的一維 Array 執行個體。

(繼承來源 Hashtable)
Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetEnumerator()

傳回透過 IDictionaryEnumerator 重複的 Hashtable

(繼承來源 Hashtable)
GetHash(Object)

傳回指定索引鍵的雜湊程式碼。

(繼承來源 Hashtable)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetObjectData(SerializationInfo, StreamingContext)
已淘汰.

實作 ISerializable 介面,並傳回序列化 Hashtable 所需的資料。

(繼承來源 Hashtable)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
KeyEquals(Object, Object)

比較特定的 ObjectHashtable 中的特定索引鍵。

(繼承來源 Hashtable)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
OnDeserialization(Object)

實作 ISerializable 介面,並於還原序列化完成時引發還原序列化事件。

(繼承來源 Hashtable)
Remove(Object)

Hashtable 中移除具有指定之索引鍵的項目。

(繼承來源 Hashtable)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

明確介面實作

IEnumerable.GetEnumerator()

傳回逐一查看集合的列舉值。

(繼承來源 Hashtable)

擴充方法

Cast<TResult>(IEnumerable)

IEnumerable 的項目轉換成指定的型別。

OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。

AsParallel(IEnumerable)

啟用查詢的平行化作業。

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryable

適用於

另請參閱