Class ConstructorInfoExtensions
- Namespace
- Garyon.Reflection
- Assembly
- Garyon.dll
Provides extension methods for the ConstructorInfo class.
public static class ConstructorInfoExtensions
- Inheritance
-
ConstructorInfoExtensions
- Inherited Members
Methods
InitializeInstance<T>(ConstructorInfo)
Initializes a new instance of a type, given its parameterless ConstructorInfo.
public static T InitializeInstance<T>(this ConstructorInfo ctor)
Parameters
ctorConstructorInfoThe parameterless constructor of the type. Must not be null.
Returns
- T
The initialized instance as an instance of type
T.
Type Parameters
TThe type of the resulting instance.
Exceptions
- NullReferenceException
The provided parameterless constructor was null.
InitializeInstance<T>(ConstructorInfo, params object?[]?)
Initializes a new instance of a type, given its ConstructorInfo.
public static T InitializeInstance<T>(this ConstructorInfo ctor, params object?[]? parameters)
Parameters
ctorConstructorInfoThe constructor of the type. Must not be null.
parametersobject[]The parameters to pass to the constructor
Returns
- T
The initialized instance as an instance of type
T.
Type Parameters
TThe type of the resulting instance.
Exceptions
- NullReferenceException
The provided constructor was null.