10 [__DynamicallyInvokable]
19 private bool _ownsHandle;
21 private bool _fullyInitialized;
26 [__DynamicallyInvokable]
29 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
30 [__DynamicallyInvokable]
33 return (_state & 1) == 1;
40 [__DynamicallyInvokable]
43 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
44 [__DynamicallyInvokable]
53 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.MayFail)]
56 handle = invalidHandleValue;
58 _ownsHandle = ownsHandle;
63 _fullyInitialized =
true;
67 [SecuritySafeCritical]
68 [__DynamicallyInvokable]
75 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
76 private extern void InternalFinalize();
80 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
88 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
96 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
103 [SecuritySafeCritical]
104 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
105 [__DynamicallyInvokable]
115 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
116 [__DynamicallyInvokable]
117 protected virtual void Dispose(
bool disposing)
130 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
131 private extern void InternalDispose();
136 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
137 [__DynamicallyInvokable]
143 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
144 [__DynamicallyInvokable]
152 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.MayFail)]
153 [__DynamicallyInvokable]
159 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
160 [__DynamicallyInvokable]
Describes a set of security permissions applied to code. This class cannot be inherited.
SafeHandle(IntPtr invalidHandleValue, bool ownsHandle)
Initializes a new instance of the T:System.Runtime.InteropServices.SafeHandle class with the specifie...
static void SuppressFinalize(object obj)
Requests that the common language runtime not call the finalizer for the specified object.
Provides a mechanism for releasing unmanaged resources.To browse the .NET Framework source code for t...
Ensures that all finalization code in derived classes is marked as critical.
void SetHandle(IntPtr handle)
Sets the handle to the specified pre-existing handle.
Represents a wrapper class for operating system handles. This class must be inherited.
Cer
Specifies a method's behavior when called within a constrained execution region.
void SetHandleAsInvalid()
Marks a handle as no longer used.
void DangerousRelease()
Manually decrements the reference counter on a T:System.Runtime.InteropServices.SafeHandle instance.
SecurityAction
Specifies the security actions that can be performed using declarative security.
abstract bool ReleaseHandle()
When overridden in a derived class, executes the code required to free the handle.
void DangerousAddRef(ref bool success)
Manually increments the reference counter on T:System.Runtime.InteropServices.SafeHandle instances.
A platform-specific type that is used to represent a pointer or a handle.
MethodImplOptions
Defines the details of how a method is implemented.
Controls the system garbage collector, a service that automatically reclaims unused memory.
IntPtr handle
Specifies the handle to be wrapped.
abstract bool IsInvalid
When overridden in a derived class, gets a value indicating whether the handle value is invalid.
bool IsClosed
Gets a value indicating whether the handle is closed.
IntPtr DangerousGetHandle()
Returns the value of the F:System.Runtime.InteropServices.SafeHandle.handle field.
void Dispose()
Releases all resources used by the T:System.Runtime.InteropServices.SafeHandle class.
void Close()
Marks the handle for releasing and freeing resources.
Consistency
Specifies a reliability contract.
virtual void Dispose(bool disposing)
Releases the unmanaged resources used by the T:System.Runtime.InteropServices.SafeHandle class specif...