Skip to content

Support for a global Context #45

@TheoVC

Description

@TheoVC

Receiving a list of variables is helpfull, but it would be great if instead of this

var eval = new ExpressionEvaluator(variables);

the library could receive an object which would be the context. (similar to what roslyn does)

var eval = new ExpressionEvaluator(Person1);

then all the properties, variables and methods would be directly accessible

eval.Evaluate(" Name + \" \" + LastName ");
eval.Evaluate(" aPersonMethod() + 10");

where Person1 is an instance of the class

public class Person{
   public string Name {get;set;}
   public string LastName {get;set;}
   public int aPersonMethod(){
      return 10;
   }
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions