VariantWrapper(Object) Constructor
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Initialiseert een nieuw exemplaar van de VariantWrapper klasse voor de opgegeven Object parameter.
public:
VariantWrapper(System::Object ^ obj);
public VariantWrapper(object obj);
new System.Runtime.InteropServices.VariantWrapper : obj -> System.Runtime.InteropServices.VariantWrapper
Public Sub New (obj As Object)
Parameters
- obj
- Object
Het object aan marshal.
Voorbeelden
In het volgende codevoorbeeld ziet u hoe u de VariantWrapper klasse gebruikt om een Object interoperabiliteits marshaler te verpakken als 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)