CriticalHandle.IsInvalid 屬性

定義

在衍生類別中覆寫時,取得值以指出這個控制代碼值是否無效。When overridden in a derived class, gets a value indicating whether the handle value is invalid.

public:
 abstract property bool IsInvalid { bool get(); };
public abstract bool IsInvalid { get; }
member this.IsInvalid : bool
Public MustOverride ReadOnly Property IsInvalid As Boolean

屬性值

如果控制代碼有效,則為 true;否則為 falsetrue if the handle is valid; otherwise, false.

備註

衍生的類別必須實 IsInvalid 屬性,才能讓 common language runtime 判斷是否需要進行重要的最終處理。Derived classes must implement the IsInvalid property so that the common language runtime can determine whether critical finalization is required. 衍生類別必須提供適合其支援的一般控制碼類型的實作為(0或-1 無效)。Derived classes must provide an implementation that suits the general type of handle they support (0 or -1 is invalid). 然後,可以針對特定的安全控制碼類型進一步衍生這些類別。These classes can then be further derived for specific safe handle types.

不同于 IsClosed 屬性,它會報告 CriticalHandle 物件是否已使用基礎控制碼完成,IsInvalid 屬性會計算給定的控制碼值是否一律視為無效。Unlike the IsClosed property, which reports whether the CriticalHandle object has finished using the underlying handle, the IsInvalid property calculates whether the given handle value is always considered invalid. 因此,IsInvalid 屬性一律會針對任何一個控制碼值傳回相同的值。Therefore, the IsInvalid property always returns the same value for any one handle value.

適用於

另請參閱