DispatchProxy.Create 方法

定義

多載

名稱 Description
Create(Type, Type)

建立一個由類別 proxyType 衍生並實作介面 interfaceType的物件實例。

Create<T,TProxy>()

建立一個由類別 TProxy 衍生並實作介面 T的物件實例。

Create(Type, Type)

來源:
DispatchProxy.cs
來源:
DispatchProxy.cs
來源:
DispatchProxy.cs
來源:
DispatchProxy.cs

建立一個由類別 proxyType 衍生並實作介面 interfaceType的物件實例。

public:
 static System::Object ^ Create(Type ^ interfaceType, Type ^ proxyType);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Creating a proxy instance requires generating code at runtime")]
public static object Create(Type interfaceType, Type proxyType);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Creating a proxy instance requires generating code at runtime")>]
static member Create : Type * Type -> obj
Public Shared Function Create (interfaceType As Type, proxyType As Type) As Object

參數

interfaceType
Type

代理應該實作的介面。

proxyType
Type

代理類別的基礎類別。

傳回

一個實 interfaceType作 的物件實例。

屬性

例外狀況

interfaceTypeproxyTypenull

interfaceType 不是介面類型。

-或-

proxyType 是密封的或抽象的,或不繼承自型 DispatchProxy 別,或沒有無參數建構子。

適用於

Create<T,TProxy>()

來源:
DispatchProxy.cs
來源:
DispatchProxy.cs
來源:
DispatchProxy.cs
來源:
DispatchProxy.cs
來源:
DispatchProxy.cs

建立一個由類別 TProxy 衍生並實作介面 T的物件實例。

public:
generic <typename T, typename TProxy>
 where TProxy : System::Reflection::DispatchProxy static T Create();
public static T Create<T,TProxy>() where TProxy : System.Reflection.DispatchProxy;
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Creating a proxy instance requires generating code at runtime")]
public static T Create<T,TProxy>() where TProxy : System.Reflection.DispatchProxy;
static member Create : unit -> 'T (requires 'Proxy :> System.Reflection.DispatchProxy)
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Creating a proxy instance requires generating code at runtime")>]
static member Create : unit -> 'T (requires 'Proxy :> System.Reflection.DispatchProxy)
Public Shared Function Create(Of T, TProxy) () As T

類型參數

T

代理應該實作的介面。

TProxy

代理類別的基礎類別。

傳回

T

一個實 T作 的物件實例。

屬性

例外狀況

T 不是介面型別,或 TProxy 是封閉、抽象,或沒有無參數建構子。

適用於