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.

struct System.​Runtime.​InteropServices.​GCHandle

Assembly: System.Runtime

Provides a way to access a managed object from unmanaged memory.

Properties

public bool
IsAllocated
Gets a value indicating whether the handle is allocated.
public object
Target
Gets or sets the object this handle represents.

Methods

public nint
AddrOfPinnedObject​()
Returns The address of the pinned data object.
Retrieves the address of object data in a <see cref="F:System.Runtime.InteropServices.GCHandleType.Pinned" /> handle.
public bool
Equals​(object o)
o The <see cref="T:System.Runtime.InteropServices.GCHandle" /> object to compare with the current <see cref="T:System.Runtime.InteropServices.GCHandle" /> object.
Returns <see langword="true" /> if the specified <see cref="T:System.Runtime.InteropServices.GCHandle" /> object is equal to the current <see cref="T:System.Runtime.InteropServices.GCHandle" /> object; otherwise, <see langword="false" /> .
Determines whether the specified <see cref="T:System.Runtime.InteropServices.GCHandle" /> object is equal to the current <see cref="T:System.Runtime.InteropServices.GCHandle" /> object.
public bool
Equals​(GCHandle other)
other An instance to compare with this instance.
Returns <see langword="true" /> if the current instance is equal to the other instance; otherwise, <see langword="false" /> .
Indicates whether the current instance is equal to another instance of the same type.
public void
Free​()
Releases a <see cref="T:System.Runtime.InteropServices.GCHandle" /> .
public int
GetHashCode​()
Returns An identifier for the current <see cref="T:System.Runtime.InteropServices.GCHandle" /> object.
Returns an identifier for the current <see cref="T:System.Runtime.InteropServices.GCHandle" /> object.
public string
ToString​()
Inherited from ValueType
Returns The fully qualified type name.
Returns the fully qualified type name of this instance.
protected void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
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" /> .