Giter VIP home page Giter VIP logo

ncalc2's Introduction

NCalc2 clone

Clone of the CoreCLR-NCalc (https://github.com/sklose/NCalc2) which in turn is a clone of NCalc from http://ncalc.codeplex.com/ This cloane fixes sime issues I needed fixed for my uses (e.g. allowing type conversion in function parameter search so that double and int anc be used interchangebly so that integer literals can be used in double calls without adding ".0") and allows to some degree access to lmbda context object members and member methods. at this stage accessign members of members is possible and also members of returned function results, but function call parameters are just IConver()ed from string Writing this readme - I shoul've branched... might do so instead. if I havent feel free to pull there if you want

Expressions with Functions and Parameters

class ExpressionContext
{
  public int Param1 { get; set; }
  public string Param2 { get; set; }
  public class CCC
  {
    public int ccc = 5;
    public double funcA() { return 22.2;}
  }
  public CCC C = new CCC();
  public double Foo(double a, double b, double c)
  {
    return a + b + c;
  }
}

var expr = new Expression("Foo([Param1], C.ccc, c.funcA()) = 29.2 && [Param2] = 'test'");
Func<ExpressionContext, bool> f = expr.ToLambda<ExpressionContext, bool>();

var context = new ExpressionContext { Param1 = 2, Param2 = "test" };
Console.WriteLine(f(context)); // will print True

ncalc2's People

Contributors

sklose avatar itai42 avatar bradtglass avatar fadulalla avatar sebastienros avatar eero-dev avatar kfrancis avatar lukas-ais avatar malukuseito avatar randbrown avatar tyrone-sudeium avatar dgeller-ouhsc avatar victoriatolls avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.