Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
Marshal Class
Marshal Methods

  Switch on low bandwidth view
Members FilterMembers Filter
Frameworks FilterFrameworks Filter
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
Marshal Methods

The Marshal type exposes the following members.

  NameDescription
Public methodStatic memberSupported by the .NET Compact FrameworkAddRefIncrements the reference count on the specified interface.
Public methodStatic memberSupported by the .NET Compact FrameworkAllocCoTaskMemAllocates a block of memory of specified size from the COM task memory allocator.
Public methodStatic memberSupported by the .NET Compact FrameworkAllocHGlobalOverloaded. Allocates a block of memory using LocalAlloc.
Public methodStatic memberBindToMonikerGets an interface pointer identified by the specified moniker.
Public methodStatic memberChangeWrapperHandleStrengthChanges the strength of a COM callable wrapper's (CCW) handle on the object it contains.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkCopyOverloaded. Copies data from a managed array to an unmanaged memory pointer, or from an unmanaged memory pointer to a managed array.
Public methodStatic memberCreateAggregatedObjectAggregates a managed object with the specified COM object.
Public methodStatic memberCreateWrapperOfTypeWraps the specified COM object in an object of the specified type.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkDestroyStructureFrees all substructures pointed to by the specified unmanaged memory block.
Public methodStatic memberSupported by the .NET Compact FrameworkFinalReleaseComObjectReleases all references to a runtime callable wrapper (RCW) by setting the reference count of the supplied RCW to 0.
Public methodStatic memberSupported by the .NET Compact FrameworkFreeBSTRFrees a BSTR using SysFreeString.
Public methodStatic memberSupported by the .NET Compact FrameworkFreeCoTaskMemFrees a block of memory allocated by the unmanaged COM task memory allocator with Marshal..::.AllocCoTaskMem.
Public methodStatic memberSupported by the .NET Compact FrameworkFreeHGlobalFrees memory previously allocated from the unmanaged memory of the process with AllocHGlobal.
Public methodStatic memberGenerateGuidForTypeReturns the globally unique identifier (GUID) for the specified type, or generates a GUID using the algorithm used by the Type Library Exporter (Tlbexp.exe).
Public methodStatic memberGenerateProgIdForTypeReturns a programmatic identifier (ProgID) for the specified type.
Public methodStatic memberGetActiveObjectObtains a running instance of the specified object from the Running Object Table (ROT).
Public methodStatic memberSupported by the .NET Compact FrameworkGetComInterfaceForObjectReturns an interface pointer that represents the specified interface for an object.
Public methodStatic memberGetComInterfaceForObjectInContextReturns an interface pointer that represents the specified interface for an object, if the caller is in the same context as that object.
Public methodStatic memberGetComObjectDataGets data referenced by the specified key from the specified COM object.
Public methodStatic memberGetComSlotForMethodInfoGets the virtual function table (VTBL) slot for a specified System.Reflection..::.MemberInfo when exposed to COM.
Public methodStatic memberGetDelegateForFunctionPointerConverts an unmanaged function pointer to a delegate.
Public methodStatic memberGetEndComSlotGets the last slot in the virtual function table (VTBL) of a type when exposed to COM.
Public methodStatic memberGetExceptionCodeRetrieves a code that identifies the type of the exception that occurred.
Public methodStatic memberSupported by the .NET Compact FrameworkGetExceptionForHROverloaded. Converts an HRESULT error code to a corresponding Exception object.
Public methodStatic memberGetExceptionPointersRetrieves a computer-independent description of an exception, and information about the state that existed for the thread when the exception occurred.
Public methodStatic memberSupported by the .NET Compact FrameworkGetFunctionPointerForDelegateConverts a delegate into a function pointer callable from unmanaged code.
Public methodStatic memberGetHINSTANCEReturns the instance handle (HINSTANCE) for the specified module.
Public methodStatic memberSupported by the .NET Compact FrameworkGetHRForExceptionConverts the specified exception to an HRESULT.
Public methodStatic memberGetHRForLastWin32ErrorReturns the HRESULT corresponding to the last error incurred by Win32 code executed using Marshal.
Public methodStatic memberSupported by the .NET Compact FrameworkGetIDispatchForObjectReturns an IDispatch interface from a managed object.
Public methodStatic memberGetIDispatchForObjectInContextReturns an IDispatch interface pointer from a managed object, if the caller is in the same context as that object.
Public methodStatic memberGetITypeInfoForTypeReturns an ITypeInfo interface from a managed type.
Public methodStatic memberSupported by the .NET Compact FrameworkGetIUnknownForObjectReturns an IUnknown interface from a managed object.
Public methodStatic memberGetIUnknownForObjectInContextReturns an IUnknown interface from a managed object, if the caller is in the same context as that object.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkGetLastWin32ErrorReturns the error code returned by the last unmanaged function called using platform invoke that has the DllImportAttribute..::.SetLastError flag set.
Public methodStatic memberGetManagedThunkForUnmanagedMethodPtr Obsolete. Gets a pointer to a thunk that marshals a call from managed to unmanaged code.
Public methodStatic memberGetMethodInfoForComSlotRetrieves MethodInfo for the specified virtual function table (VTBL) slot.
Public methodStatic memberSupported by the .NET Compact FrameworkGetNativeVariantForObjectConverts an object to a COM VARIANT.
Public methodStatic memberSupported by the .NET Compact FrameworkGetObjectForIUnknownReturns an instance of a type that represents a COM object by a pointer to its IUnknown interface.
Public methodStatic memberSupported by the .NET Compact FrameworkGetObjectForNativeVariantConverts a COM VARIANT to an object.
Public methodStatic memberGetObjectsForNativeVariantsConverts an array of COM VARIANTs to an array of objects.
Public methodStatic memberGetStartComSlotGets the first slot in the virtual function table (VTBL) that contains user defined methods.
Public methodStatic memberGetThreadFromFiberCookie Obsolete. Converts a fiber cookie into the corresponding System.Threading..::.Thread instance.
Public methodStatic memberSupported by the .NET Compact FrameworkGetTypedObjectForIUnknownReturns a managed object of a specified type that represents a COM object.
Public methodStatic memberGetTypeForITypeInfoConverts an ITypeInfo into a managed Type object.
Public methodStatic memberGetTypeInfoNameOverloaded. Retrieves the name of the type represented by an ITypeInfo.
Public methodStatic memberGetTypeLibGuidOverloaded. Retrieves the library identifier (LIBID) of a type library.
Public methodStatic memberGetTypeLibGuidForAssemblyRetrieves the library identifier (LIBID) that is assigned to a type library when it was exported from the specified assembly.
Public methodStatic memberGetTypeLibLcidOverloaded. Retrieves the LCID of a type library.
Public methodStatic memberGetTypeLibNameOverloaded. Retrieves the name of a type library.
Public methodStatic memberGetTypeLibVersionForAssemblyRetrieves the version number of a type library that will be exported from the specified assembly.
Public methodStatic memberGetUniqueObjectForIUnknownCreates a unique runtime callable wrapper (RCW) object for a given IUnknown.
Public methodStatic memberGetUnmanagedThunkForManagedMethodPtr Obsolete. Gets a pointer to a thunk that marshals a call from unmanaged to managed code.
Public methodStatic memberSupported by the .NET Compact FrameworkIsComObjectIndicates whether a specified object represents a COM object.
Public methodStatic memberSupported by the .NET Compact FrameworkIsTypeVisibleFromComIndicates whether a type is visible to COM clients.
Public methodStatic memberNumParamBytesCalculates the number of bytes in unmanaged memory that are required to hold the parameters for the specified method.
Public methodStatic memberOffsetOfReturns the field offset of the unmanaged form of the managed class.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkPrelinkExecutes one-time method setup tasks without calling the method.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkPrelinkAllPerforms a pre-link check for all methods on a class.
Public methodStatic memberPtrToStringAnsiOverloaded. Allocates a managed String and copies all or part of an unmanaged ANSI string into it.
Public methodStatic memberPtrToStringAutoOverloaded. Allocates a managed String and copies a specified number of characters from an unmanaged string into it.
Public methodStatic memberSupported by the .NET Compact FrameworkPtrToStringBSTRAllocates a managed String and copies a BSTR string stored in unmanaged memory into it.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkPtrToStringUniOverloaded. Allocates a managed String and copies a specified number of characters from an unmanaged Unicode string into it.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkPtrToStructureOverloaded. Marshals data from an unmanaged block of memory to a managed object.
Public methodStatic memberSupported by the .NET Compact FrameworkQueryInterfaceRequests a pointer to a specified interface from a COM object.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkReadByteOverloaded. Reads a single byte from an unmanaged pointer. Reading from unaligned memory locations is supported.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkReadInt16Overloaded. Reads a 16-bit signed integer from unmanaged memory. Reading from unaligned memory locations is supported.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkReadInt32Overloaded. Reads a 32-bit signed integer from unmanaged memory. Reading from unaligned memory locations is supported.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkReadInt64Overloaded. Reads a 64-bit signed integer from unmanaged memory. Reading from unaligned memory locations is supported.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkReadIntPtrOverloaded. Reads a processor native sized integer from unmanaged memory. Reading from unaligned memory locations is supported.
Public methodStatic memberSupported by the .NET Compact FrameworkReAllocCoTaskMemResizes a block of memory previously allocated with AllocCoTaskMem.
Public methodStatic memberSupported by the .NET Compact FrameworkReAllocHGlobalResizes a block of memory previously allocated with AllocHGlobal.
Public methodStatic memberSupported by the .NET Compact FrameworkReleaseDecrements the reference count on the specified interface.
Public methodStatic memberSupported by the .NET Compact FrameworkReleaseComObjectDecrements the reference count of the supplied runtime callable wrapper.
Public methodStatic memberReleaseThreadCache Obsolete. Releases the thread cache.
Public methodStatic memberSecureStringToBSTRAllocates a BSTR and copies the contents of a managed SecureString object into it.
Public methodStatic memberSecureStringToCoTaskMemAnsiCopies the contents of a managed SecureString object to a block of memory allocated from the unmanaged COM task allocator.
Public methodStatic memberSecureStringToCoTaskMemUnicodeCopies the contents of a managed SecureString object to a block of memory allocated from the unmanaged COM task allocator.
Public methodStatic memberSecureStringToGlobalAllocAnsiCopies the contents of a managed SecureString into unmanaged memory, converting into ANSI format as it copies.
Public methodStatic memberSecureStringToGlobalAllocUnicodeCopies the contents of a managed SecureString into unmanaged memory.
Public methodStatic memberSetComObjectDataSets data referenced by the specified key in the specified COM object.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkSizeOfOverloaded. Returns the unmanaged size, in bytes, of a class using Marshal.
Public methodStatic memberSupported by the .NET Compact FrameworkStringToBSTRAllocates a BSTR and copies the contents of a managed String into it.
Public methodStatic memberStringToCoTaskMemAnsiCopies the contents of a managed String to a block of memory allocated from the unmanaged COM task allocator.
Public methodStatic memberStringToCoTaskMemAutoCopies the contents of a managed String to a block of memory allocated from the unmanaged COM task allocator.
Public methodStatic memberStringToCoTaskMemUniCopies the contents of a managed String to a block of memory allocated from the unmanaged COM task allocator.
Public methodStatic memberStringToHGlobalAnsiCopies the contents of a managed String into unmanaged memory, converting into ANSI format as it copies.
Public methodStatic memberStringToHGlobalAutoCopies the contents of a managed String into unmanaged memory, converting into ANSI format if required.
Public methodStatic memberStringToHGlobalUniCopies the contents of a managed String into unmanaged memory.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkStructureToPtrMarshals data from a managed object to an unmanaged block of memory.
Public methodStatic memberSupported by the .NET Compact FrameworkThrowExceptionForHROverloaded. Throws an exception with a specific failure HRESULT value.
Public methodStatic memberUnsafeAddrOfPinnedArrayElementGets the address of the element at the specified index inside the specified array.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkWriteByteOverloaded. Writes a single byte value to unmanaged memory.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkWriteInt16Overloaded. Writes a 16-bit signed integer value to unmanaged memory. Writing to unaligned memory locations is supported.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkWriteInt32Overloaded. Writes a 32-bit signed integer value to unmanaged memory. Writing to unaligned memory locations is supported.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkWriteInt64Overloaded. Writes a 64-bit signed integer value to unmanaged memory. Writing to unaligned memory locations is supported.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkWriteIntPtrOverloaded. Writes a processor native sized integer value to unmanaged memory. Writing to unaligned memory locations is supported.
Public methodStatic memberZeroFreeBSTRFrees a BSTR pointer that was allocated using the SecureStringToBSTR method.
Public methodStatic memberZeroFreeCoTaskMemAnsiFrees an unmanaged string pointer that was allocated using the SecureStringToCoTaskMemAnsi method.
Public methodStatic memberZeroFreeCoTaskMemUnicodeFrees an unmanaged string pointer that was allocated using the SecureStringToCoTaskMemUnicode method.
Public methodStatic memberZeroFreeGlobalAllocAnsiFrees an unmanaged string pointer that was allocated using the SecureStringToGlobalAllocAnsi method.
Public methodStatic memberZeroFreeGlobalAllocUnicodeFrees an unmanaged string pointer that was allocated using the SecureStringToCoTaskMemUnicode method.
Top
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker