Marshal.CreateWrapperOfType 메서드

정의

오버로드

CreateWrapperOfType(Object, Type)
사용되지 않음.

지정된 형식의 개체에 지정된 COM 개체를 래핑합니다.

CreateWrapperOfType<T,TWrapper>(T)

지정된 형식의 개체에 지정된 COM 개체를 래핑합니다.

CreateWrapperOfType(Object, Type)

Source:
Marshal.NoCom.cs
Source:
Marshal.NoCom.cs
Source:
Marshal.NoCom.cs

주의

CreateWrapperOfType(Object, Type) may be unavailable in future releases. Instead, use CreateWrapperOfType<T,T2>(T). For more info, go to http://go.microsoft.com/fwlink/?LinkID=296519

지정된 형식의 개체에 지정된 COM 개체를 래핑합니다.

public:
 static System::Object ^ CreateWrapperOfType(System::Object ^ o, Type ^ t);
[System.Obsolete("CreateWrapperOfType(Object, Type) may be unavailable in future releases. Instead, use CreateWrapperOfType<T,T2>(T). For more info, go to http://go.microsoft.com/fwlink/?LinkID=296519")]
[System.Security.SecurityCritical]
public static object CreateWrapperOfType (object o, Type t);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public static object? CreateWrapperOfType (object? o, Type t);
[System.Security.SecurityCritical]
public static object CreateWrapperOfType (object o, Type t);
public static object CreateWrapperOfType (object o, Type t);
public static object? CreateWrapperOfType (object? o, Type t);
[<System.Obsolete("CreateWrapperOfType(Object, Type) may be unavailable in future releases. Instead, use CreateWrapperOfType<T,T2>(T). For more info, go to http://go.microsoft.com/fwlink/?LinkID=296519")>]
[<System.Security.SecurityCritical>]
static member CreateWrapperOfType : obj * Type -> obj
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member CreateWrapperOfType : obj * Type -> obj
[<System.Security.SecurityCritical>]
static member CreateWrapperOfType : obj * Type -> obj
static member CreateWrapperOfType : obj * Type -> obj
Public Shared Function CreateWrapperOfType (o As Object, t As Type) As Object

매개 변수

o
Object

래핑될 개체입니다.

t
Type

만들 래퍼의 형식입니다.

반환

원하는 형식의 인스턴스인 새로 래핑된 개체입니다.

특성

예외

t__ComObject에서 파생되어야 합니다.

또는

t는 Windows 런타임 형식입니다.

t 매개 변수가 null인 경우

o는 필요한 모든 인터페이스를 지원하지는 않으므로 대상 개체로 변환될 수 없습니다.

설명

CreateWrapperOfType 는 하나의 COM 클래스 형식(일반적으로 기본 __ComObject 형식)을 다른 COM 클래스 형식으로 변환합니다. 매개 변수 o로 표시되는 입력 COM 개체는 RCW(런타임 호출 가능 래퍼)입니다.

to 매개 변수는 모두 시그니처가 로 특성System.Runtime.InteropServices.ComImportAttribute이 지정된 클래스여야 합니다. Tlbimp.exe(형식 라이브러리 가져오기) 도구는 형식 라이브러리를 가져올 때 이 특성을 적용합니다. 소스 코드에서 RCW를 수동으로 만드는 경우 COM 원본을 나타내는 원래 coclass를 나타내는 관리되는 서명에 이 특성을 적용해야 합니다.

Tlbimp.exe COM coclass 를 관리되는 클래스 및 인터페이스로 가져옵니다. coclass 인터페이스의 이름은 원래 coclass와 같으며 관리되는 클래스에는 "Class"가 추가된 원래 coclass 이름이 있습니다. 예를 들어 라는 coclass는 라는 MyCoclass coclass 인터페이스와 라는 MyCoclassMyCoclassClass관리되는 클래스가 됩니다. t 는 인터페이스가 아닌 클래스여야 하므로 coclass 인터페이스가 아닌 관리되는 클래스(MyCoclassClass)를 지정해야 합니다.

참고

새 RCW instance 원래 RCW에 의해 노출된 IUnknown 포인터를 래핑하므로 입력 COM 개체의 ID가 손실됩니다.

추가 정보

적용 대상

CreateWrapperOfType<T,TWrapper>(T)

Source:
Marshal.NoCom.cs
Source:
Marshal.NoCom.cs
Source:
Marshal.NoCom.cs

지정된 형식의 개체에 지정된 COM 개체를 래핑합니다.

public:
generic <typename T, typename TWrapper>
 static TWrapper CreateWrapperOfType(T o);
[System.Security.SecurityCritical]
public static TWrapper CreateWrapperOfType<T,TWrapper> (T o);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public static TWrapper CreateWrapperOfType<T,TWrapper> (T? o);
public static TWrapper CreateWrapperOfType<T,TWrapper> (T o);
[<System.Security.SecurityCritical>]
static member CreateWrapperOfType : 'T -> 'Wrapper
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member CreateWrapperOfType : 'T -> 'Wrapper
static member CreateWrapperOfType : 'T -> 'Wrapper
Public Shared Function CreateWrapperOfType(Of T, TWrapper) (o As T) As TWrapper

형식 매개 변수

T

래핑할 개체의 형식입니다.

TWrapper

반환할 개체의 형식입니다.

매개 변수

o
T

래핑될 개체입니다.

반환

TWrapper

새로 래핑된 개체입니다.

특성

예외

T__ComObject에서 파생되어야 합니다.

또는

T는 Windows 런타임 형식입니다.

o가 원하는 모든 인터페이스를 지원하지 않으므로 TWrapper으로 변환할 수 없는 경우

설명

CreateWrapperOfType<T,TWrapper>(T) 는 형식 T 의 COM 개체를 COM 클래스 형식으로 TWrapper 변환합니다. 매개 변수 o로 표시되는 입력 COM 개체는 RCW(런타임 호출 가능 래퍼)입니다.

T 제네릭 형식 매개 변수와 매개 변수는 o 모두 시그니처가 특성으로 System.Runtime.InteropServices.ComImportAttribute 지정된 클래스여야 합니다. Tlbimp.exe(형식 라이브러리 가져오기) 도구는 형식 라이브러리를 가져올 때 이 특성을 적용합니다. 소스 코드에서 RCW를 수동으로 만드는 경우 COM 원본을 나타내는 원래 coclass를 나타내는 관리되는 서명에 이 특성을 적용해야 합니다.

Tlbimp.exe COM coclass 를 관리되는 클래스 및 인터페이스로 가져옵니다. coclass 인터페이스의 이름은 원래 coclass와 같으며 관리되는 클래스에는 "Class"가 추가된 원래 coclass 이름이 있습니다. 예를 들어 라는 coclass는 라는 MyCoclass coclass 인터페이스와 라는 MyCoclassMyCoclassClass관리되는 클래스가 됩니다. 는T 인터페이스가 아닌 클래스여야 하므로 인터페이스가 아닌 coclass 관리되는 클래스(MyCoclassClass)를 지정해야 합니다.

참고

새 RCW instance 원래 RCW에 의해 노출된 IUnknown 포인터를 래핑하므로 입력 COM 개체의 ID가 손실됩니다.

적용 대상