Creates a MemberExpression that represents accessing a property or field.
Assembly: System.Core (in System.Core.dll)
static member PropertyOrField : expression:Expression * propertyOrFieldName:string -> MemberExpression
- Type: System.Linq.Expressions.Expression
- Type: System.String
The name of a property or field to be accessed.
Return ValueType: System.Linq.Expressions.MemberExpression
A MemberExpression that has the NodeType property equal to MemberAccess, the Expression property set to expression, and the Member property set to the PropertyInfo or FieldInfo that represents the property or field denoted by propertyOrFieldName.
The Type property of the resulting MemberExpression is equal to the PropertyType or FieldType properties of the PropertyInfo or FieldInfo, respectively, that represents the property or field denoted by propertyOrFieldName.
This method searches expression.Type and its base types for a property or field that has the name propertyOrFieldName. Public properties and fields are given preference over non-public properties and fields. Also, properties are given preference over fields. If a matching property or field is found, this method passes expression and the PropertyInfo or FieldInfo that represents that property or field to Property or Field, respectively.
.NET FrameworkSupported in: 4.5.2, 4.5.1, 4.5, 4, 3.5
.NET Framework Client ProfileSupported in: 4, 3.5 SP1
Portable Class LibrarySupported in: Portable Class Library
.NET for Windows Store appsSupported in: Windows 8
.NET for Windows Phone appsSupported in: Windows Phone 8.1, Windows Phone 8, Silverlight 8.1
Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.