Show / Hide Table of Contents

Class Type<T>.Constructor<TParam>

Provides access to constructor of type T with single parameter.

Inheritance
Object
Type<T>.Constructor<TParam>
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
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 Source

Get(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.

| Improve this Doc View Source

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 T.

Exceptions
Type Condition
MissingConstructorException

Constructor doesn't exist.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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 T if constructor exists.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX