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

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

C#
public static object Create(Type interfaceType, Type proxyType);

Parameters

interfaceType
Type
proxyType
Type

Returns

An object instance that implements interfaceType.

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

.NET 10 i druge verzije
Proizvod Verzije
.NET 8, 9, 10

Create<T,TProxy>()

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

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

C#
public static T Create<T,TProxy>() where TProxy : System.Reflection.DispatchProxy;

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.

Exceptions

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

Applies to

.NET 10 i druge verzije
Proizvod Verzije
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.0 (package-provided), 2.1 (package-provided), 2.1
UWP 10.0