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

Expression error using Empty Type #75

Closed vzsoft closed 4 years ago

vzsoft commented 4 years ago

Hi,

I got Error in Empty Type (Test = new { })

my class:

    public class AppUser 
    {
        public string Name { get; set; }
        public int? Age { get; set; }
    }

my code:


var lst = Enumerable.Range(1, 10).Select(x => new AppUser() { Name = "1", Age = x }).ToList();

Eval.Execute("({0}).Select(x => new {x.Name, Test = new { } }).ToList()", lst);

Thank you

JonathanMagnan commented 4 years ago

Hello @vzsoft ,

Thank you for reporting. I didn't know it was possible to create an anonymous without any property (never think about it!).

We will look at it.

Best Regards,

Jon

JonathanMagnan commented 4 years ago

Hello @vzsoft ,

The v4.0.0 has been released.

We now support empty anonymous.

Please make sure to check your expression when you upgrade since the v4.0.0 got a big logic re-write: https://github.com/zzzprojects/Eval-Expression.NET/releases/tag/v4.0.0

vzsoft commented 4 years ago

thank you so much

JonathanMagnan commented 4 years ago

Hello @vzsoft

Did you get the time to try the latest version?

Looking forward to hearing from you,

Jon

vzsoft commented 4 years ago

Hello Jonathan

yes, i got version 4 and great work

JonathanMagnan commented 4 years ago

Awesome!

don't hesitate to contact us for questions, issues or feedback.

Best regards,

Jon