❔ ✅ Get name of assigned property in an Expression
I am (partially for fun) writing the following method:
Here is how I intend to call it:
I'd like to parse the Expression argument above such that I have
Where ExtractMaps is an extension method that returns this structure (denoted in JSON for clarity)
Is this possible in C#?
5 Replies
your constraint selector is an expression tree. go through the individual nodes and figure out what you got
there should be a visitor base class for that, or just go through them manually
you are expecting a certain structure after all
🦥 fine...
Thank you
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.@AntonC just following up, got this working perfectly 👍
Wrote an
ExpressionVisitor
subclass, and the rest is historyWas this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.