zzzprojects / Eval-Expression.NET

C# Eval Expression | Evaluate, Compile, and Execute C# code and expression at runtime.
https://eval-expression.net/
Other
449 stars 86 forks source link

Is it possible to support nameof operator? #98

Closed cesaryuan closed 3 years ago

cesaryuan commented 3 years ago

Is it possible to support nameof operator to get the variable name?

Console.WriteLine(nameof(System.Collections.Generic));  // output: Generic
Console.WriteLine(nameof(List<int>));  // output: List
Console.WriteLine(nameof(List<int>.Count));  // output: Count
Console.WriteLine(nameof(List<int>.Add));  // output: Add

var numbers = new List<int> { 1, 2, 3 };
Console.WriteLine(nameof(numbers));  // output: numbers
Console.WriteLine(nameof(numbers.Count));  // output: Count
Console.WriteLine(nameof(numbers.Add));  // output: Add
JonathanMagnan commented 3 years ago

Hello @cesaryuan ,

We will look at it.

Best Regards,

Jon

JonathanMagnan commented 3 years ago

Hello @cesaryuan ,

The v4.0.36 has been released.

Could you try it and let us know if everything is working as expected for the nameof operator?

Best Regards,

Jon

JonathanMagnan commented 3 years ago

Hello @cesaryuan ,

Since our last conversation, we haven't heard from you!

Did you get the chance to try the v4.0.36?

Don't hesitate to contact us for further assistance,

Jon

cesaryuan commented 3 years ago

I'm sorry to reply to you so late. I've tried and it performs well. Thank you.