Compartilhar via


Método Marshal.FreeBSTR (IntPtr)

 

Dica

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Libera um BSTR usando o COM SysFreeString função.

Namespace:   System.Runtime.InteropServices
Assembly:  mscorlib (em mscorlib.dll)

Sintaxe

[SecurityCriticalAttribute]
public static void FreeBSTR(
    IntPtr ptr
)
public:
[SecurityCriticalAttribute]
static void FreeBSTR(
    IntPtr ptr
)
[<SecurityCriticalAttribute>]
static member FreeBSTR : 
        ptr:nativeint -> unit
<SecurityCriticalAttribute>
Public Shared Sub FreeBSTR (
    ptr As IntPtr
)

Parâmetros

Comentários

Como Marshal.FreeCoTaskMem e Marshal.FreeHGlobal, você pode usar esse método para desalocar memória.FreeBSTRchama o COM SysFreeString função, o que libera a memória alocada por qualquer um dos seguintes métodos não gerenciados: SysAllocString, SysAllocStringByteLen, SysAllocStringLen, SysReAllocString, SysReAllocStringLen . Você pode chamar métodos não gerenciados, como esses recursos com a plataforma invocar. Para obter detalhes, consulte Consumindo funções de DLL não gerenciadas.

Segurança

SecurityCriticalAttribute

requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.

Informações de Versão

Plataforma Universal do Windows
Disponível desde 8
.NET Framework
Disponível desde 1.1
Biblioteca de Classes Portátil
Com suporte no: plataformas portáteis do .NET
Windows Phone
Disponível desde 8.1

Confira Também

FreeCoTaskMem
FreeHGlobal
Classe Marshal
Namespace System.Runtime.InteropServices

Retornar ao início