This documentation is archived and is not being maintained.

Expression.Property Method (Expression, String)

Creates a MemberExpression that represents accessing a property given the name of the property.

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

Public Shared Function Property ( _
	expression As Expression, _
	propertyName As String _
) As MemberExpression
Dim expression As Expression 
Dim propertyName As String 
Dim returnValue As MemberExpression 

returnValue = Expression.Property(expression, _


Type: System.Linq.Expressions.Expression

An Expression whose Type contains a property named propertyName.

Type: System.String

The name of a property.

Return Value

Type: 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 that represents the property denoted by propertyName.


expression or propertyName is Nothing.


No property named propertyName is defined in expression.Type or its base types.

The Type property of the resulting MemberExpression is equal to the PropertyType property of the PropertyInfo that represents the property denoted by propertyName.

This method searches expression.Type and its base types for a property that has the name propertyName. Public properties are given preference over non-public properties. If a matching property is found, this method passes expression and the PropertyInfo that represents that property to Property.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5