다음을 통해 공유


Marshal.CreateWrapperOfType 메서드

정의

오버로드

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

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

CreateWrapperOfType<T,TWrapper>(T)

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

CreateWrapperOfType(Object, Type)

Source:
Marshal.NoCom.cs
Source:
Marshal.NoCom.cs
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(런타임 호출 가능 래퍼)입니다.

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

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

메모

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

추가 정보

적용 대상

CreateWrapperOfType<T,TWrapper>(T)

Source:
Marshal.NoCom.cs
Source:
Marshal.NoCom.cs
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 이름이 있습니다. 예를 들어 호출 MyCoclass 된 coclass는 호출된 coclass 인터페이스가 되고 관리되는 클래스는 호출 MyCoclassClassMyCoclass 됩니다. T 인터페이스가 아닌 클래스여야 하므로 인터페이스가 아닌 coclass 관리되는 클래스(MyCoclassClass)를 지정해야 합니다.

메모

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

적용 대상