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

pipe operator in string interpolation #82

Closed cuiliang closed 4 years ago

cuiliang commented 4 years ago

Hi, Is there any chance to implement "pipe operator" like angular or other templating language? like this:

$"Title through uppercase pipe: {title | uppercase}"
$"Title through uppercase pipe: {title | uppercase : 'param1','param2' | someOtherFunc }"

which means call 'upcase' function on title, then interpolation. I konw it's nothing about c# , but It will be very useful in a expression.

JonathanMagnan commented 4 years ago

Hello @cuiliang ,

Thank you for reporting.

I will ask my developer to look at this to see what's possible to do and what's the best for the future.

Best Regards,

Jon

JonathanMagnan commented 4 years ago

Hello @cuiliang ,

We talked about it internally and for now, we will try to avoid doing it as time doesn't permit and this request might require too much effort.

However, it's already possible to call some external method in interpolation, I'm not sure if that could work for you: https://dotnetfiddle.net/kqMZAl

Let me know if that alternative solution could work for you.

Best Regards,

Jon

cuiliang commented 4 years ago

got it, thank you!