Construtor VariantWrapper (Object)
Dica
The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.
Inicializa uma nova instância da classe VariantWrapper do parâmetro System.Object especificado.
Namespace: System.Runtime.InteropServices
Assembly: mscorlib (em mscorlib.dll)
Sintaxe
public VariantWrapper(
object obj
)
public:
VariantWrapper(
Object^ obj
)
new :
obj:Object -> VariantWrapper
Public Sub New (
obj As Object
)
Parâmetros
obj
Type: System.ObjectO objeto a se realizar marshaling.
Exemplos
O exemplo de código a seguir demonstra como usar o VariantWrapper classe para encapsular um Object que o marshaler interoperabilidade passa como VT_VARIANT | VT_BYREF.
// Create an instance of an unmanged COM object.
UnmanagedComClass UnmanagedComClassInstance = new UnmanagedComClass();
// Create a string to pass to the COM object.
string helloString = "Hello World!";
// Wrap the string with the VariantWrapper class.
object var = new System.Runtime.InteropServices.VariantWrapper(helloString);
// Pass the wrapped object.
UnmanagedComClassInstance.MethodWithStringRefParam(ref var);
' Create an instance of an unmanged COM object.
Dim UnmanagedComClassInstance As New UnmanagedComClass()
' Create a string to pass to the COM object.
Dim helloString As String = "Hello World!"
' Wrap the string with the VariantWrapper class.
Dim var As Object = New System.Runtime.InteropServices.VariantWrapper(helloString)
' Pass the wrapped object.
UnmanagedComClassInstance.MethodWithStringRefParam(var)
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
Classe VariantWrapper
Namespace System.Runtime.InteropServices
Retornar ao início