zzzprojects / Eval-Expression.NET

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

string.Left method #12

Closed lynnmiller closed 7 years ago

lynnmiller commented 7 years ago

I downloaded Eval-Expression.NET and am trying it out.

The following command works and returns "Lynn":

string result4 = Eval.Execute("String.Copy(\"Lynn\")");

This command errors out.

string result5 = Eval.Execute("String.Copy(\"Lynn\").Left(1)");

Should I be able to do something like I am trying to do? I am trying to understand the capabilities of this library by trying different scenarios.

Thanks.

JonathanMagnan commented 7 years ago

Hello @lynnmiller ,

The following statement String.Copy("Lynn").Left(1); is not a valid C# statement. It doesn't compile even without our library.

The short answer is no, you should not be able (unless we add this syntax in our library like we did with a few syntax).

If it's an extension method that you added to your library, you must register it. By example:

RegisterExtensionMethod(typeof(Enumerable));

Let me know if that answer to your question.

Best Regards,

Jonathan

JonathanMagnan commented 7 years ago

Hello @lynnmiller ,

We will close this issue since no more question has been asked.

Feel free to reopen if you need more information.

Best Regards,

Jonathan