score:2

Accepted answer

Expression.Call is the way to go. But still you would need to use semantic data to get associated reflection data such as Types and MethodInfo.

The way to go about it is:

  1. Get compilation object by calling Compilation.Create(...) in other words: compile your program using Roslyn API
  2. Get SemanticModel out of it by calling GetSemanticModel(ast)
  3. Get TypeInfo calling GetTypeInfo(expression)

So... to sum it up

Compilation.Create(...).GetSemanticModel(ast).GetTypeInfo(expression);

Related Query

More Query from same tag