Table of Contents

Method Get

Namespace
Xunit.v3
Assembly
xunit.v3.core.dll

Get<TInterface>(Type?, object?[]?)

Gets an instance of the given type, casting it to TInterface, using the provided constructor arguments.

public static TInterface? Get<TInterface>(Type? type, object?[]? ctorArgs = null) where TInterface : class

Parameters

type Type

The implementation type.

ctorArgs object[]

The constructor arguments. Since diagnostic message sinks are optional, the code first looks for a type that takes the given arguments plus the message sink, and only falls back to the message sink-less constructor if none was found.

Returns

TInterface

The instance of the type.

Type Parameters

TInterface

The interface type.