Edit

Share via


DispatchProxy.Create Method

Definition

Overloads

Create(Type, Type)

Creates an object instance that derives from class proxyType and implements interface interfaceType.

Create<T,TProxy>()

Creates an object instance that derives from class TProxy and implements interface T.

Create(Type, Type)

Source:
DispatchProxy.cs
Source:
DispatchProxy.cs
Source:
DispatchProxy.cs

Creates an object instance that derives from class proxyType and implements interface 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

Parameters

interfaceType
Type

The interface the proxy should implement.

proxyType
Type

The base class to use for the proxy class.

Returns

An object instance that implements interfaceType.

Attributes

Exceptions

interfaceType or proxyType is null.

interfaceType is a class.

-or-

proxyType is sealed or abstract, or doesn't inherit from the DispatchProxy type or has a parameterless constructor.

Applies to

Create<T,TProxy>()

Source:
DispatchProxy.cs
Source:
DispatchProxy.cs
Source:
DispatchProxy.cs
Source:
DispatchProxy.cs

Creates an object instance that derives from class TProxy and implements interface 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

Type Parameters

T

The interface the proxy should implement.

TProxy

The base class to use for the proxy class.

Returns

T

An object instance that implements T.

Attributes

Exceptions

T is a class, or TProxy is sealed or does not have a parameterless constructor.

Applies to