VariantWrapper(Object) 생성자

정의

지정된 VariantWrapper 매개 변수에 대한 클래스의 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)

매개 변수

obj
Object

마샬링할 개체입니다.

예제

다음 코드 예제에서는 interop 마샬러가 전달하는 클래스를 VariantWrapper 래핑하는 방법을 Object 보여 줍니다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)

적용 대상