Flylib.com

Books Software

 
 
 

GCHandleType

GCHandleType CF 1.0, ECMA 1.0, serializable

System.Runtime.InteropServices (mscorlib.dll) enum

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 garbage-collected . However, Weak causes the object to be zeroed out before the finalizer runs, but WeakTrackResurrection does not zero the object, so the object's finalizer can safely resurrect it.

public enum

GCHandleType

{

Weak = 0

,

WeakTrackResurrection = 1

,

Normal = 2

,

Pinned = 3

}

Hierarchy

System.Object System.ValueType System.Enum(System.IComparable , System.IFormattable , System.IConvertible) GCHandleType

Passed To

GCHandle.Alloc( )

GuidAttribute CF 1.0

System.Runtime.InteropServices (mscorlib.dll) sealed class

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 name ( [GuidAttribute( )] rather than [Guid( )] ) to avoid clashes with the System.Guid type.

public sealed class

GuidAttribute

: Attribute {

// Public Constructors

public

GuidAttribute

(string


guid


);

// Public Instance Properties

public string

Value

{get; }
}

Hierarchy

System.Object System.Attribute GuidAttribute

Valid On

Assembly, Class, Struct, Enum, Interface, Delegate

HandleRef

System.Runtime.InteropServices (mscorlib.dll) struct

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 guaranteed that the garbage collector will not touch it until the PInvoke call returns.

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 System.ValueType HandleRef

IDispatchImplAttribute

System.Runtime.InteropServices (mscorlib.dll) sealed class

There are multiple implementations of IDispatch available for you to expose dual interfaces and dispinterfaces to COM. Attach this attribute to a class or an assembly to specify which IDispatch implementation to use. If you apply this attribute to an assembly, it applies to all classes within that assembly. For a list of available IDispatch implementations, see IDispatchImplType .

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 System.Attribute IDispatchImplAttribute

Valid On

Assembly, Class