You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the Copy watch expression context menu command produces the following (using expr as the root expression):
expr
This makes sense if the purpose is just to paste into the Watch window. But what if the user wants to write further properties in the Watch window, for example, expr.Body. Because the code expression expr is typed as Expression and not as LambdaExpression, a further cast will be required:
((LambdaExpression)expr).Body
The same is true for further property usages. For example. getting properties on the results of ((LambdaExpression)expr).Body. We'd need a further cast.
One issue -- without knowing which property is being used, we'd have to cast to the actual type of the object. Some types -- specifically Expression<T> -- get names with the generic parameter, and full assembly::
Given the following code:
the Copy watch expression context menu command produces the following (using
expr
as the root expression):This makes sense if the purpose is just to paste into the Watch window. But what if the user wants to write further properties in the Watch window, for example,
expr.Body
. Because the code expressionexpr
is typed asExpression
and not asLambdaExpression
, a further cast will be required:The same is true for further property usages. For example. getting properties on the results of
((LambdaExpression)expr).Body
. We'd need a further cast.One issue -- without knowing which property is being used, we'd have to cast to the actual type of the object. Some types -- specifically
Expression<T>
-- get names with the generic parameter, and full assembly::If this issue only comes up in
Expression<T>
, we could useLambdaExpression
, which is higher up in the type tree.In any case, we have to travel up the inheritance tree, looking for the first public type.
The text was updated successfully, but these errors were encountered: