Show / Hide Table of Contents

Class Type<T>.Constructor

Provides access to constructor of type T without parameters.

Inheritance
Object
Type<T>.Constructor
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

Methods

| Improve this Doc View Source

Get(Boolean)

Returns public constructor of type T without parameters.

Declaration
public static Constructor<Func<T>> Get(bool nonPublic = false)
Parameters
Type Name Description
Boolean nonPublic

true to reflect non-public constructor.

Returns
Type Description
Constructor<Func<T>>

Reflected constructor without parameters; or null, if it doesn't exist.

| Improve this Doc View Source

Get<TSignature>(Boolean)

Reflects constructor of type T which signature is specified by delegate type.

Declaration
public static Constructor<TSignature> Get<TSignature>(bool nonPublic = false)

    where TSignature : MulticastDelegate
Parameters
Type Name Description
Boolean nonPublic

true to reflect non-public constructor.

Returns
Type Description
Constructor<TSignature>

Reflected constructor; or null, if constructor doesn't exist.

Type Parameters
Name Description
TSignature

Type of delegate describing constructor signature.

| Improve this Doc View Source

Invoke(Boolean)

Invokes constructor.

Declaration
public static T Invoke(bool nonPublic = false)
Parameters
Type Name Description
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 public constructor of type T without parameters.

Declaration
public static Constructor<Func<T>> Require(bool nonPublic = false)
Parameters
Type Name Description
Boolean nonPublic

true to reflect non-public constructor.

Returns
Type Description
Constructor<Func<T>>

Reflected constructor without parameters.

Exceptions
Type Condition
MissingConstructorException

Constructor doesn't exist.

| Improve this Doc View Source

Require<TSignature>(Boolean)

Reflects constructor of type T which signature is specified by delegate type.

Declaration
public static Constructor<TSignature> Require<TSignature>(bool nonPublic = false)

    where TSignature : MulticastDelegate
Parameters
Type Name Description
Boolean nonPublic

true to reflect non-public constructor.

Returns
Type Description
Constructor<TSignature>

Reflected constructor.

Type Parameters
Name Description
TSignature

Type of delegate describing constructor signature.

Exceptions
Type Condition
MissingConstructorException

Constructor doesn't exist.

| Improve this Doc View Source

TryInvoke(Boolean)

Invokes constructor.

Declaration
public static Optional<T> TryInvoke(bool nonPublic = false)
Parameters
Type Name Description
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