This enumeration contains values for the two-argument form of
GCHandle.Alloc( )
.
Normal
protects the object from being garbage collected, and
Pinned
does the same (but it also enables the
GCHandle.AddrOfPinnedObject( )
method).
Weak
and
WeakTrackResurrection
both allow the object to be
public enum GCHandleType { Weak = 0 , WeakTrackResurrection = 1 , Normal = 2 , Pinned = 3 } Hierarchy
System.Object
Passed ToGCHandle.Alloc( ) |
This attribute is used to specify the GUID of assemblies, modules, or types you expose to COM. If you don't use this attribute to specify a GUID, one is automatically generated. When you apply this attribute, use its full
public sealed class GuidAttribute : Attribute { // Public Constructors public GuidAttribute (string guid ); // Public Instance Properties public string Value {get; } } Hierarchy
System.Object
Valid OnAssembly, Class, Struct, Enum, Interface, Delegate |
When you pass a managed object into unmanaged code using PInvoke, there is a chance that the garbage collector will finalize the object before the unmanaged code is finished with it. This can only happen when your managed code does not reference the object after the PInvoke call. Because the garbage collector's reach does not extend into unmanaged code, this fools the garbage collector into thinking that you are finished with it.
This class is used to wrap your managed object before passing it into unmanaged code, and you are
public struct HandleRef { // Public Constructors public HandleRef (object wrapper , IntPtr handle ); // Public Instance Properties public IntPtr Handle {get; } public object Wrapper {get; } // Public Static Methods public static explicit operator IntPtr (HandleRef value ); } Hierarchy
System.Object
|
There are multiple
public sealed class IDispatchImplAttribute : Attribute { // Public Constructors public IDispatchImplAttribute (IDispatchImplType implType ); public IDispatchImplAttribute (short implType ); // Public Instance Properties public IDispatchImplType Value {get; } } Hierarchy
System.Object
Valid OnAssembly, Class |