I need to translate strings like this:
"DateTime.Now.AddDays(-7)"
into their equivalent expressions.
I’m only interested in the DateTime class. Is there anything built into .Net that’ll help me do this, or do I just need to write my own little parser?
You can employ FLEE to do the expression parsing for you. The below code is tested and working in Silverlight (I believe in full C#, it may have a slightly different syntax around creating the expression, but it might work exactly like this anyway)