Expression.New Method (ConstructorInfo)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Creates a NewExpression that represents calling the specified constructor that takes no arguments.

Namespace:   System.Linq.Expressions
Assembly:  System.Core (in System.Core.dll)

static member New : 
        constructor:ConstructorInfo -> NewExpression

Parameters

constructor
Type: System.Reflection.ConstructorInfo

The ConstructorInfo to set the Constructor property equal to.

Return Value

Type: System.Linq.Expressions.NewExpression

A NewExpression that has the NodeType property equal to New and the Constructor property set to the specified value.

Exception Condition
ArgumentNullException

constructor is null.

ArgumentException

The constructor that constructor represents has at least one parameter.

The Arguments and Members properties of the resulting NewExpression are empty collections. The Type property represents the declaring type of the constructor represented by constructor.

Universal Windows Platform
Available since 8
.NET Framework
Available since 3.5
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show: