Field Method (Expression, FieldInfo)
Collapse the table of content
Expand the table of content

Expression.Field Method (Expression, FieldInfo)

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Creates a MemberExpression that represents accessing a field.

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

'Declaration
Public Shared Function Field ( _
	expression As Expression, _
	field As FieldInfo _
) As MemberExpression

Parameters

expression
Type: System.Linq.Expressions.Expression
An Expression to set the Expression property equal to. For static (Shared in Visual Basic), expression must be Nothing.
field
Type: System.Reflection.FieldInfo
The FieldInfo to set the Member property equal to.

Return Value

Type: System.Linq.Expressions.MemberExpression
A MemberExpression that has the NodeType property equal to MemberAccess and the Expression and Member properties set to the specified values.

ExceptionCondition
ArgumentNullException

field is Nothing.

-or-

The field represented by field is not static (Shared in Visual Basic) and expression is Nothing.

ArgumentException

expression.Type is not assignable to the declaring type of the field represented by field.

The Type property of the resulting MemberExpression is equal to the FieldType property of field.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft