VariantWrapper(Object) Construtor
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Inicializa uma nova instância da VariantWrapper classe para o parâmetro especificado Object .
public:
VariantWrapper(System::Object ^ obj);
public VariantWrapper(object obj);
public VariantWrapper(object? obj);
new System.Runtime.InteropServices.VariantWrapper : obj -> System.Runtime.InteropServices.VariantWrapper
Public Sub New (obj As Object)
Parâmetros
- obj
- Object
O objetivo a marshal.
Exemplos
O exemplo de código seguinte demonstra como usar a VariantWrapper classe para envolver um Object que o marshaler de 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)