Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Runtime.​InteropServices.​CriticalHandle
Assembly: System.Runtime
Inheritance: object → ConstrainedExecution.CriticalFinalizerObject → CriticalHandle
Represents a wrapper class for handle resources.
Fields and Constants
protected
nint
handle
Specifies the handle to be wrapped.
Properties
public
bool
IsClosed
Gets a value indicating whether the handle is closed.
public
bool
IsInvalid
When overridden in a derived class, gets a value indicating whether the handle value is invalid.
Methods
public
void
Close​()
Marks the handle for releasing and freeing resources.
public
void
Dispose​()
Releases all resources used by the <see cref="T:System.Runtime.InteropServices.CriticalHandle" /> .
protected
void
Dispose​(bool disposing)
disposing
<see langword="true" /> for a normal dispose operation; <see langword="false" /> to finalize the handle.
Releases the unmanaged resources used by the <see cref="T:System.Runtime.InteropServices.CriticalHandle" /> class specifying whether to perform a normal dispose operation.
protected
void
Finalize​()
Frees all resources associated with the handle.
protected
bool
ReleaseHandle​() Returns <see langword="true" /> if the handle is released successfully; otherwise, in the event of a catastrophic failure, <see langword="false" /> . In this case, it generates a releaseHandleFailed Managed Debugging Assistant.
When overridden in a derived class, executes the code required to free the handle.
protected
void
SetHandle​(nint handle)
handle
The pre-existing handle to use.
Sets the handle to the specified pre-existing handle.
public
void
SetHandleAsInvalid​()
Marks a handle as invalid.
public
bool
Equals​(object obj)
Inherited from object
obj
The object to compare with the current object.
Returns <see langword="true" /> if the specified object is equal to the current object; otherwise, <see langword="false" /> .
Determines whether the specified object is equal to the current object.
public
int
GetHashCode​()
Inherited from object
Returns A hash code for the current object.
Serves as the default hash function.
public
Type
GetType​()
Inherited from object
Returns The exact runtime type of the current instance.
Gets the <see cref="T:System.Type" /> of the current instance.
protected
object
MemberwiseClone​()
Inherited from object
Returns A shallow copy of the current <see cref="T:System.Object" /> .
Creates a shallow copy of the current <see cref="T:System.Object" /> .
public
string
ToString​()
Inherited from object
Returns A string that represents the current object.
Returns a string that represents the current object.