Skip to content

Sum of decimal fail #65

Closed
Closed
@TheoVC

Description

@TheoVC

the library is resolving sum like an integer... not diferenciating if a property is a decimal... probably it's failing for another datatypes like float, double, etc.

var Persons = new List<Person>() { new Person() { Code = "QT00010", Name = "Pedrito", Number = 11.11m },
            new Person() { Code = "QT00011", Name = "Pablito", Number = 12.11m }};

ExpressionEvaluator evaluator = new ExpressionEvaluator();
evaluator.Context = new { Persons };
object val1 = evaluator.Evaluate("Persons.Sum(x=>x.Number)");
Console.WriteLine(val1);

public class Person{
        public string Code { get; set; }
        public string Name { get; set; }
        public decimal Number { get; set; }
}

this should print a decimal 23.22, but it's printing an int 23

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions