c# - Displaying FQN in Expression.Call -


I'm trying to represent the string of Static method calls that I've created using Expression Tree. However, FQN is not a literal representation in text representation. TestMethod () output code instead of AnotherClass.TestMethod () Edit: This is just a simple example Eventually the output can be something like this: -

  Other class. Test method method & gt; Guid & gt; ("BLOB_DATA", New MyClass ())   

Therefore, I'm not just trying to get the FQN of a method, the original expression object may not even call a method I thought Was that the expression is too complicated, no toasting will return the C # code which it can represent

The goal is to convert the original expression into the C # code snippet, which I used to remember in memory I can use and compile.

  using the system; Using System.Linq.Expressions; Using the system. Namespace Expression Test {Private Static Zero Main (string [] Args) {// Version 1 Dyslexation Call = Expression Call (type off (other class), "testmanth", type elite type); Console.WriteLine (call.ToString ()); // version 2 methodInfo method = type (other class). GetMethi ("Testmith"); MethodCallExpressionCall2 = Expression. Call (method); Console.WriteLine (call2.ToString ()); Console.ReadLine (); }} Internal category other class {public static zero} TestMethod () {}}} 
  string.format ("{0}. {1}", type the disclaimer .name, method .name)   

if (recently edited in your queue ) You want to turn some expression into executable, you can do something instead:

  action compiled = expression Lambda & lt; Action & gt; (Call 2). Compile ();   

You can call the compiled expression because you have another action

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -