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.
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.MemberExpressionA MemberExpression that has the NodeType property equal to MemberAccess and the Expression and Member properties set to the specified values.
| Exception | Condition |
|---|---|
| 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.