Marshal Methods
.NET Framework 1.1
The methods of the Marshal class are listed here. For a complete list of Marshal class members, see the Marshal Members topic.
Public Methods
![]() AddRef | Increments the reference count on the specified interface. |
![]() AllocCoTaskMem | Allocates a block of memory of specified size from the COM task memory allocator. |
![]() AllocHGlobal | Overloaded. Allocates a block of memory using GlobalAlloc. |
![]() BindToMoniker | Gets an interface pointer identified by the specified moniker. |
![]() ChangeWrapperHandleStrength | Changes the strength of a COM callable wrapper's (CCW) handle on the object it contains. |
![]() Copy Supported by the .NET Compact Framework. | Overloaded. Copies data from a managed array to an unmanaged memory pointer. |
![]() CreateWrapperOfType | Wraps the specified COM object in an object of the specified type. |
![]() DestroyStructure | Frees all substructures pointed to by the specified unmanaged memory block. |
![]() FreeBSTR | Frees a BSTR using SysFreeString. |
![]() FreeCoTaskMem | Frees a block of memory allocated by the unmanaged COM task memory allocator with Marshal.AllocCoTaskMem. |
![]() FreeHGlobal | Frees memory previously allocated from the unmanaged memory of the process with AllocHGlobal. |
![]() GenerateGuidForType | Returns the globally unique identifier (GUID) for the specified type, or generates a GUID using the algorithm used by the Type Library Exporter (Tlbexp.exe). |
![]() GenerateProgIdForType | Returns a programmatic identifier (ProgID) for the specified type. |
![]() GetActiveObject | Obtains a running instance of the specified object from the Running Object Table (ROT). |
![]() GetComInterfaceForObject | Returns an IUnknown pointer representing the specified interface for an object. |
![]() GetComObjectData | Gets data referenced by the specified key from the specified COM object. |
![]() GetComSlotForMethodInfo | Gets the virtual function table (VTBL) slot for a specified System.Reflection.MemberInfo when exposed to COM. |
![]() GetEndComSlot | Gets the last slot in the virtual function table (VTBL) of a type when exposed to COM. |
![]() GetExceptionCode | Retrieves a code that identifies the type of the exception that occurred. |
![]() GetExceptionPointers | Retrieves a computer-independent description of an exception, and information about the state that existed for the thread when the exception occurred. |
![]() GetHINSTANCE | Returns the instance handle (HINSTANCE) for the specified module. |
![]() GetHRForException | Converts the specified exception to an HRESULT. |
![]() GetHRForLastWin32Error | Returns the HRESULT corresponding to the last error incurred by Win32 code executed using Marshal. |
![]() GetIDispatchForObject | Returns an IDispatch interface from a managed object. |
![]() GetITypeInfoForType | Returns an ITypeInfo interface from a managed type. |
![]() GetIUnknownForObject | Returns an IUnknown interface from a managed object. |
![]() GetLastWin32Error Supported by the .NET Compact Framework. | Returns the error code returned by the last unmanaged function called using platform invoke that has the DllImportAttribute.SetLastError flag set. |
![]() GetManagedThunkForUnmanagedMethodPtr | Gets a pointer to a thunk that marshals a call from managed to unmanaged code. |
![]() GetMethodInfoForComSlot | Retrieves MethodInfo for the specified virtual function table (VTBL) slot. |
![]() GetNativeVariantForObject | Converts an object to a COM VARIANT. |
![]() GetObjectForIUnknown | Returns an instance of a type that represents a COM object by a pointer to its IUnknown interface. |
![]() GetObjectForNativeVariant | Converts a COM VARIANT to an object. |
![]() GetObjectsForNativeVariants | Converts an array of COM VARIANTs to an array of objects. |
![]() GetStartComSlot | Gets the first slot in the virtual function table (VTBL) that contains user defined methods. |
![]() GetThreadFromFiberCookie | Converts a fiber cookie into the corresponding System.Threading.Thread instance. |
![]() GetTypedObjectForIUnknown | Returns a managed object of a specified type that represents a COM object. |
![]() GetTypeForITypeInfo | Converts an ITypeInfo into a managed Type object. |
![]() GetTypeInfoName | Retrieves the name of the type represented by an ITypeInfo. |
![]() GetTypeLibGuid | Retrieves the library identifier (LIBID) of a type library. |
![]() GetTypeLibGuidForAssembly | Retrieves the library identifier (LIBID) that is assigned to a type library when it was exported from the specified assembly. |
![]() GetTypeLibLcid | Retrieves the LCID of a type library. |
![]() GetTypeLibName | Retrieves the name of a type library. |
![]() GetUnmanagedThunkForManagedMethodPtr | Gets a pointer to a thunk that marshals a call from unmanaged to managed code. |
![]() IsComObject Supported by the .NET Compact Framework. | Indicates whether a specified object represents a COM object. |
![]() IsTypeVisibleFromCom | Indicates whether a type is visible to COM clients. |
![]() NumParamBytes | Calculates the number of bytes required to hold the parameters for the specified method. |
![]() OffsetOf | Returns the field offset of the unmanaged form of the managed class. |
![]() Prelink | Executes one-time method setup tasks without calling the method. |
![]() PrelinkAll | Performs a pre-link check for all methods on a class. |
![]() PtrToStringAnsi | Overloaded. Allocates a managed String and copies all or part of an unmanaged ANSI string into it. |
![]() PtrToStringAuto | Overloaded. Allocates a managed String and copies a specified number of characters from an unmanaged string into it. |
![]() PtrToStringBSTR | Allocates a managed String and copies a BSTR string stored in unmanaged memory into it. |
![]() PtrToStringUni Supported by the .NET Compact Framework. | Overloaded. Allocates a managed String and copies a specified number of characters from an unmanaged Unicode string into it. |
![]() PtrToStructure Supported by the .NET Compact Framework. | Overloaded. Marshals data from an unmanaged block of memory to a managed object. |
![]() QueryInterface | Requests a pointer to a specified interface from a COM object. |
![]() ReadByte Supported by the .NET Compact Framework. | Overloaded. Reads a single byte from an unmanaged pointer. |
![]() ReadInt16 Supported by the .NET Compact Framework. | Overloaded. Reads a 16-bit signed integer from unmanaged memory. |
![]() ReadInt32 Supported by the .NET Compact Framework. | Overloaded. Reads a 32-bit signed integer from unmanaged memory. |
![]() ReadInt64 | Overloaded. Reads a 64-bit signed integer from unmanaged memory. |
![]() ReadIntPtr | Overloaded. Reads a processor native sized integer from unmanaged memory. |
![]() ReAllocCoTaskMem | Resizes a block of memory previously allocated with AllocCoTaskMem. |
![]() ReAllocHGlobal | Resizes a block of memory previously allocated with AllocHGlobal. |
![]() Release | Decrements the reference count on the specified interface. |
![]() ReleaseComObject | Decrements the reference count of the supplied runtime callable wrapper. |
![]() ReleaseThreadCache | This member supports the .NET Framework infrastructure and is not intended to be used directly from your code. |
![]() SetComObjectData | Sets data referenced by the specified key in the specified COM object. |
![]() SizeOf Supported by the .NET Compact Framework. | Overloaded. Returns the unmanaged size, in bytes, of a class using Marshal. |
![]() StringToBSTR | Allocates a BSTR and copies the contents of a managed String into it. |
![]() StringToCoTaskMemAnsi | Copies the contents of a managed String to a block of memory allocated from the unmanaged COM task allocator. |
![]() StringToCoTaskMemAuto | Copies the contents of a managed String to a block of memory allocated from the unmanaged COM task allocator. |
![]() StringToCoTaskMemUni | Copies the contents of a managed String to a block of memory allocated from the unmanaged COM task allocator. |
![]() StringToHGlobalAnsi | Copies the contents of a managed String into unmanaged memory, converting into ANSI format as it copies. |
![]() StringToHGlobalAuto | Copies the contents of a managed String into unmanaged memory, converting into ANSI format if required. |
![]() StringToHGlobalUni | Copies the contents of a managed String into unmanaged memory. |
![]() StructureToPtr Supported by the .NET Compact Framework. | Marshals data from a managed object to an unmanaged block of memory. |
![]() ThrowExceptionForHR | Overloaded. Throws an exception with a specific failure HRESULT value. |
![]() UnsafeAddrOfPinnedArrayElement | Gets the address of the element at the specified index inside the specified array. |
![]() WriteByte Supported by the .NET Compact Framework. | Overloaded. Writes a single byte value to unmanaged memory. |
![]() WriteInt16 Supported by the .NET Compact Framework. | Overloaded. Writes a 16-bit signed integer value to unmanaged memory. |
![]() WriteInt32 Supported by the .NET Compact Framework. | Overloaded. Writes a 32-bit signed integer value to unmanaged memory. |
![]() WriteInt64 | Overloaded. Writes a 64-bit signed integer value to unmanaged memory. |
![]() WriteIntPtr | Overloaded. Writes a processor native sized integer value to unmanaged memory. |
