Поделиться через


Expression.New Method (ConstructorInfo)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

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

Syntax

'Declaration
Public Shared Function New ( _
    constructor As ConstructorInfo _
) As NewExpression
public static NewExpression New(
    ConstructorInfo constructor
)

Parameters

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.

Exceptions

Exception Condition
ArgumentNullException

constructor is nulla null reference (Nothing in Visual Basic).

ArgumentException

The constructor that constructor represents has at least one parameter.

Remarks

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.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.