ObjectIDGenerator ObjectIDGenerator ObjectIDGenerator ObjectIDGenerator Class

定義

產生物件的 ID。Generates IDs for objects.

public ref class ObjectIDGenerator
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class ObjectIDGenerator
type ObjectIDGenerator = class
Public Class ObjectIDGenerator
繼承
ObjectIDGeneratorObjectIDGeneratorObjectIDGeneratorObjectIDGenerator
屬性

備註

ObjectIDGenerator記錄的先前已識別的物件。The ObjectIDGenerator keeps track of previously identified objects. 當您要求的物件識別碼ObjectIDGenerator知道是否傳回現有的識別碼,或產生,並請記得新的識別碼。When you ask for the ID of an object, the ObjectIDGenerator knows whether to return the existing ID, or generate and remember a new ID.

識別碼是唯一的生命週期的ObjectIDGenerator執行個體。The IDs are unique for the life of the ObjectIDGenerator instance. 一般而言,ObjectIDGenerator生命週期會持續長達Formatter,建立它。Generally, a ObjectIDGenerator life lasts as long as the Formatter that created it. 只有在指定的序列化資料流,內有意義的物件識別碼,以及用於追蹤哪些物件具有其他序列化的物件圖形內的參考。Object IDs have meaning only within a given serialized stream, and are used for tracking which objects have references to others within the serialized object graph.

使用雜湊表,ObjectIDGenerator保留的識別碼指派給哪些物件。Using a hash table, the ObjectIDGenerator retains which ID is assigned to which object. 物件參考,用來唯一識別每個物件,是在執行階段記憶體回收堆積中的位址。The object references, which uniquely identify each object, are addresses in the runtime garbage-collected heap. 物件參考值可以變更在序列化期間,但資料表會自動更新,因此資訊正確無誤。Object reference values can change during serialization, but the table is updated automatically so the information is correct.

物件識別碼是 64 位元數字。Object IDs are 64-bit numbers. 從其中一個,會啟動配置,所以零不是有效的物件識別碼。Allocation starts from one, so zero is never a valid object ID. 格式器可以選擇零的值來表示其值的物件參考nullA formatter can choose a zero value to represent an object reference whose value is null.

建構函式

ObjectIDGenerator() ObjectIDGenerator() ObjectIDGenerator() ObjectIDGenerator()

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

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

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

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

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

(Inherited from Object)
GetId(Object, Boolean) GetId(Object, Boolean) GetId(Object, Boolean) GetId(Object, Boolean)

傳回指定物件的 ID,如果指定物件尚未由 ObjectIDGenerator 識別,則產生新 ID。Returns the ID for the specified object, generating a new ID if the specified object has not already been identified by the ObjectIDGenerator.

GetType() GetType() GetType() GetType()

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

(Inherited from Object)
HasId(Object, Boolean) HasId(Object, Boolean) HasId(Object, Boolean) HasId(Object, Boolean)

判斷物件是否已經指派 ID。Determines whether an object has already been assigned an ID.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

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

(Inherited from Object)
ToString() ToString() ToString() ToString()

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

(Inherited from Object)

適用於

另請參閱