WaitHandle.SafeWaitHandle WaitHandle.SafeWaitHandle WaitHandle.SafeWaitHandle WaitHandle.SafeWaitHandle Property


取得或設定原生 (Native) 的作業系統控制代碼。Gets or sets the native operating system handle.

 property Microsoft::Win32::SafeHandles::SafeWaitHandle ^ SafeWaitHandle { Microsoft::Win32::SafeHandles::SafeWaitHandle ^ get(); void set(Microsoft::Win32::SafeHandles::SafeWaitHandle ^ value); };
[get: System.Security.SecurityCritical]
[set: System.Security.SecurityCritical]
public Microsoft.Win32.SafeHandles.SafeWaitHandle SafeWaitHandle { get; set; }
member this.SafeWaitHandle : Microsoft.Win32.SafeHandles.SafeWaitHandle with get, set
Public Property SafeWaitHandle As SafeWaitHandle


SafeWaitHandle,代表原生作業系統控制代碼。A SafeWaitHandle representing the native operating system handle.


當您將新值指派給 SafeWaitHandle 屬性時,會在收集先前的 SafeWaitHandle 物件時關閉先前的控制碼。When you assign a new value to the SafeWaitHandle property, the previous handle will be closed when the previous SafeWaitHandle object is collected. 請勿手動關閉控制碼,因為當 SafeWaitHandle 嘗試關閉控制碼時,這會導致 ObjectDisposedExceptionDo not manually close the handle, because this results in an ObjectDisposedException when the SafeWaitHandle attempts to close the handle.

WaitHandle 會執行 Dispose 模式。WaitHandle implements the Dispose pattern. 請參閱執行 Dispose 方法See Implementing a Dispose method. 當您從 WaitHandle 衍生時,請使用 SafeWaitHandle 屬性來儲存您的原生控制碼作業系統控制碼。When you derive from WaitHandle, use the SafeWaitHandle property to store your native handle operating system handle. 除非您使用其他非受控資源,否則不需要覆寫受保護的 Dispose 方法。You do not need to override the protected Dispose method unless you use additional unmanaged resources.


需要完全信任立即呼叫者。Requires full trust for the immediate caller. 部分信任或透明的程式碼無法使用這個成員。This member cannot be used by partially trusted or transparent code.

衍生類型必須有 UnmanagedCode,才能呼叫這個成員。Derived types must have UnmanagedCode to call this member.