Table of Contents

Class ActivatorExt

Namespace
LinqToDB.Internal.Common
Assembly
linq2db.dll

APIs to call reflection-based invoke operations with automatic unwrap of TargetInvocationException on error.

public static class ActivatorExt
Inheritance
ActivatorExt
Inherited Members

Methods

CreateInstance(Type)

Creates instance of type type. Ensures that instance is not null.

public static object CreateInstance(Type type)

Parameters

type Type

Returns

object

CreateInstance(Type, bool)

Creates instance of type type.

public static object CreateInstance(Type type, bool nonPublic)

Parameters

type Type
nonPublic bool

Returns

object

CreateInstance(Type, params object?[]?)

Creates instance of type type.

public static object CreateInstance(Type type, params object?[]? args)

Parameters

type Type
args object[]

Returns

object

CreateInstance<T>()

Creates instance of T type.

public static T CreateInstance<T>()

Returns

T

Type Parameters

T

CreateInstance<T>(Type)

Creates instance of type and asserts it inherits/implements T.

public static T CreateInstance<T>(Type type) where T : class

Parameters

type Type

Returns

T

Type Parameters

T

CreateInstance<T>(Type, bool)

Creates instance of type and asserts it inherits/implements T.

public static T CreateInstance<T>(Type type, bool nonPublic) where T : class

Parameters

type Type
nonPublic bool

Returns

T

Type Parameters

T

CreateInstance<T>(Type, params object?[]?)

Creates instance of type and asserts it inherits/implements T.

public static T CreateInstance<T>(Type type, params object?[]? args) where T : class

Parameters

type Type
args object[]

Returns

T

Type Parameters

T

DynamicInvokeExt(Delegate, params object?[]?)

Invokes delegate.

public static object? DynamicInvokeExt(this Delegate method, params object?[]? args)

Parameters

method Delegate
args object[]

Returns

object

DynamicInvokeExt<T>(Delegate, params object?[]?)

Invokes delegate and asserts it return value of T type.

public static T DynamicInvokeExt<T>(this Delegate method, params object?[]? args)

Parameters

method Delegate
args object[]

Returns

T

Type Parameters

T

InvokeExt(ConstructorInfo, object?[]?)

Creates object instance by invoking contructor.

public static object InvokeExt(this ConstructorInfo ctor, object?[]? parameters)

Parameters

ctor ConstructorInfo
parameters object[]

Returns

object

InvokeExt(MethodBase, object?, object?[]?)

Invokes method.

public static object? InvokeExt(this MethodBase method, object? obj, object?[]? parameters)

Parameters

method MethodBase
obj object
parameters object[]

Returns

object

InvokeExt<T>(ConstructorInfo, object?[]?)

Creates object instance by invoking contructor and asserts created instance inherits/implements T.

public static T InvokeExt<T>(this ConstructorInfo ctor, object?[]? parameters) where T : class

Parameters

ctor ConstructorInfo
parameters object[]

Returns

T

Type Parameters

T

InvokeExt<T>(MethodBase, object?, object?[]?)

Invokes method and asserts it return value of T type.

public static T InvokeExt<T>(this MethodBase method, object? obj, object?[]? parameters)

Parameters

method MethodBase
obj object
parameters object[]

Returns

T

Type Parameters

T