PropertyExpression is missing

C#.NetLambdaExpressionExpression Trees

C# Problem Overview


I try to write a simple example using Expressions, but have a strange bug: I can't use PropertyExpression at compile time. When I write it I get an error and it doesn't compile enter image description here But in runtime at breakpoint I can write

var runtimeBody = (System.Linq.Expressions.PropertyExpression)body2;

and it works, and casts as expected. Framework 4.5.1 is selected as target.

C# Solutions


Solution 1 - C#

PropertyExpression is internal

You should cast it to System.Linq.Expressions.MemberExpression instead, as suggested in this post.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAlex ZhukovskiyView Question on Stackoverflow
Solution 1 - C#Sébastien SevrinView Answer on Stackoverflow