Class Type<T>.Constructor<TParam>
Provides access to constructor of type T with single parameter.
Inherited Members
Namespace: DotNext.Reflection
Assembly: DotNext.Reflection.dll
Syntax
public static class Constructor<TParam>
Type Parameters
| Name | Description |
|---|---|
| TParam | Type of constructor parameter. |
Methods
| Improve this Doc View SourceGet(Boolean)
Returns constructor T with single parameter of type TParam.
Declaration
public static Constructor<Func<TParam, T>> Get(bool nonPublic = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | nonPublic | true to reflect non-public constructor. |
Returns
| Type | Description |
|---|---|
| Constructor<Func<TParam, T>> | Reflected constructor with single parameter; or null, if it doesn't exist. |
Invoke(TParam, Boolean)
Invokes constructor.
Declaration
public static T Invoke(TParam arg, bool nonPublic = false)
Parameters
| Type | Name | Description |
|---|---|---|
| TParam | arg | Constructor argument. |
| Boolean | nonPublic | true to reflect non-public constructor. |
Returns
| Type | Description |
|---|---|
| T | Instance of |
Exceptions
| Type | Condition |
|---|---|
| MissingConstructorException | Constructor doesn't exist. |
Require(Boolean)
Returns constructor T with single parameter of type TParam.
Declaration
public static Constructor<Func<TParam, T>> Require(bool nonPublic = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | nonPublic | true to reflect non-public constructor. |
Returns
| Type | Description |
|---|---|
| Constructor<Func<TParam, T>> | Reflected constructor with single parameter. |
Exceptions
| Type | Condition |
|---|---|
| MissingConstructorException | Constructor doesn't exist. |
TryInvoke(TParam, Boolean)
Invokes constructor.
Declaration
public static Optional<T> TryInvoke(TParam arg, bool nonPublic = false)
Parameters
| Type | Name | Description |
|---|---|---|
| TParam | arg | Constructor argument. |
| Boolean | nonPublic | true to reflect non-public constructor. |
Returns
| Type | Description |
|---|---|
| Optional<T> | Instance of |