Detecting that a MemberExpression has a value

Posted by cs on Stack Overflow See other posts from Stack Overflow or by cs
Published on 2009-12-17T23:00:32Z Indexed on 2010/03/20 23:11 UTC
Read the original article Hit count: 312

Filed under:
|

How do I detect if a MemberExpression has a value that needs to be compiled/evaluated?

I have two separate member expression outputs, the first which has a value, and the second which doesn't. What is the best way to differentiate between the two?

exp
**{value(Microsoft.Connect.Api.Client.Tests.SearchQueryUnitTests+<>c__DisplayClass6).handle}**
    [System.Linq.Expressions.MemberExpression]: **{value(Microsoft.Connect.Api.Client.Tests.SearchQueryUnitTests+<>c__DisplayClass6).handle}**
    NodeType: MemberAccess
    Type: {Name = "String" FullName = "System.String"}

vs

exp
{x.CreatedBy}
    [System.Linq.Expressions.MemberExpression]: {x.CreatedBy}
    NodeType: MemberAccess
    Type: {Name = "String" FullName = "System.String"}

© Stack Overflow or respective owner

Related posts about c#3.0

Related posts about lambda-expressions