{"id":37051956,"url":"https://github.com/soomin-kevin-sung/dotnet-calculation-engine","last_synced_at":"2026-01-14T06:00:07.280Z","repository":{"id":223832734,"uuid":"761575632","full_name":"soomin-kevin-sung/dotnet-calculation-engine","owner":"soomin-kevin-sung","description":"CalculationEngine is a useful tool for calculating complex formulas.","archived":false,"fork":false,"pushed_at":"2024-05-08T17:10:15.000Z","size":173,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-26T23:38:04.867Z","etag":null,"topics":["calculate","csharp","dotnet","engine","expression","formula","formula-parser","utility","visualbasic"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/soomin-kevin-sung.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-22T04:51:38.000Z","updated_at":"2025-01-01T22:44:37.000Z","dependencies_parsed_at":"2024-03-04T03:37:32.541Z","dependency_job_id":"c906867f-0326-46d5-8293-eeaf3772793a","html_url":"https://github.com/soomin-kevin-sung/dotnet-calculation-engine","commit_stats":null,"previous_names":["soomin-kevin-sung/dotnet-calculation-engine"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/soomin-kevin-sung/dotnet-calculation-engine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soomin-kevin-sung%2Fdotnet-calculation-engine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soomin-kevin-sung%2Fdotnet-calculation-engine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soomin-kevin-sung%2Fdotnet-calculation-engine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soomin-kevin-sung%2Fdotnet-calculation-engine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soomin-kevin-sung","download_url":"https://codeload.github.com/soomin-kevin-sung/dotnet-calculation-engine/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soomin-kevin-sung%2Fdotnet-calculation-engine/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28412180,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T05:26:33.345Z","status":"ssl_error","status_checked_at":"2026-01-14T05:21:57.251Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["calculate","csharp","dotnet","engine","expression","formula","formula-parser","utility","visualbasic"],"created_at":"2026-01-14T06:00:06.583Z","updated_at":"2026-01-14T06:00:07.271Z","avatar_url":"https://github.com/soomin-kevin-sung.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CaculationEngine\n\n[![Build And Publish to Nuget](https://github.com/soomin-kevin-sung/dotnet-calculation-engine/actions/workflows/build_test_publish.yml/badge.svg?branch=master)](https://github.com/soomin-kevin-sung/dotnet-calculation-engine/actions/workflows/build_test_publish.yml)\n[![Nuget](https://img.shields.io/nuget/v/kevincomponent.calculationengine?label=NuGet\u0026logo=NuGet)](https://www.nuget.org/packages/KevinComponent.CalculationEngine/)\n\u003cbr\u003e\n![.NET](https://img.shields.io/badge/.NET-8.0-512BD4?style=flat)\u0026nbsp;\n![.NET](https://img.shields.io/badge/.NET-Framework%204.8-512BD4?style=flat)\u0026nbsp;\n![.NET](https://img.shields.io/badge/.NET-CoreApp%203.1-512BD4?style=flat)\u0026nbsp;\n\u003cbr\u003e\n[![CodeFactor](https://www.codefactor.io/repository/github/soomin-kevin-sung/dotnet-calculation-engine/badge)](https://www.codefactor.io/repository/github/soomin-kevin-sung/dotnet-calculation-engine)\u0026nbsp;\n[![License](https://img.shields.io/github/license/soomin-kevin-sung/dotnet-calculation-engine)](LICENSE.md)\u0026nbsp;\n![C#](https://img.shields.io/badge/.NET-C%23-007396?style=flat)\u0026nbsp;\n\n**CalculationEngine** is a useful tool for calculating complex formulas.\n\u003cbr\u003e\nIt's inspired by [Jace.NET](https://github.com/pieterderycke/Jace), and some code was taken from [Jace.NET](https://github.com/pieterderycke/Jace).\n\n## Simple Code\n*  Here is a simple piece of code that demonstrates what a CalculationEngine is.\n    ```csharp\n    // Define CalculationEngine\n    var engine = new CalculationEngine();\n\n    // Calculate Formulas\n    var answer = engine.Calculate(\"1 + 3\");\n    var answer2 = engine.Calculate(\"3 + 5 * 9\");\n    var answer3 = engine.Calculate(\"pow(3, 2) + (2 - 3)\");\n\n    /****************** RESULT ******************/\n    // answer : 4\n    // answer2 : 48\n    // answer3 : 8\n    ```\n\n## Features\n### The CalculationEngine can calculate formulas that contain strings and objects.\n* Calculating String Constants And Variables\n    ```csharp\n    var engine = new CalculationEngine();\n    var variables = new Dictionary\u003cstring, object\u003e() { { \"code\", \"PRESENT\" } };\n\n    var answer = engine.Calculate(\"if(CODE == \\\"PRESENT\\\", \\\"TRUE\\\", \\\"FALSE\\\")\", variables);\n\n    /****************** RESULT ******************/\n    // answer : \"TRUE\"\n    ```\n\u003cbr\u003e\n\n### The CalculationEngine can access the object properties by [PropertyConnector](https://github.com/soomin-kevin-sung/dotnet-calculation-engine/blob/master/src/KevinComponent/KevinComponent/Execution/PropertyConnector.cs)\n* Point Class for formula\n    ```csharp\n    public class Point\n    {\n        public Point(string name,  double x, double y)\n        {\n            Name = name;\n            X = x;\n            Y = y;\n        }\n\n        public string Name { get; set; }\n        public double X { get; set; }\n        public double Y { get; set; }\n    }\n    ```\n* Implementing a PropertyConnector to access Point class properties\n    ```csharp\n    public class PointPropertyConnector : PropertyConnector\n    {\n        public PointPropertyConnector(bool caseSensitive) : base(caseSensitive)\n        {\n        }\n\n        protected override object? OnGetPropertyValue(object target, string propertyName)\n        {\n            if (target is Point point)\n            {\n                if (propertyName.Equals(ConvertPropertyName(\".Name\")))\n                    return point.Name;\n                else if (propertyName.Equals(ConvertPropertyName(\".X\")))\n                    return point.X;\n                else if (propertyName.Equals(ConvertPropertyName(\".Y\")))\n                    return point.Y;\n            }\n\n            return null;\n        }\n    }\n    ```\n* Calculate formulas with the Point class\n    ```csharp\n    var engine = new CalculationEngine(new CalculationEngineOptions()\n    {\n        PropertyConnectorFactory = caseSensitive =\u003e new PointPropertyConnector(caseSensitive)\n    });\n    var variables = new Dictionary\u003cstring, object\u003e()\n    {\n        { \"p1\", new Point(\"A\", 0, 1) },\n        { \"p2\", new Point(\"B\", 1.25, -2.56) },\n        { \"Code\", \"A\" }\n    };\n\n    var answer = engine.Calculate(\"p1.x + p2.y\", variables);\n    var answer2 = engine.Calculate(\"if ( Code == p1.Name, \\\"True\\\", \\\"False\\\")\", variables);\n\n    /****************** RESULT ******************/\n    // answer : -2.56\n    // answer2 : \"True\"\n    ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoomin-kevin-sung%2Fdotnet-calculation-engine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoomin-kevin-sung%2Fdotnet-calculation-engine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoomin-kevin-sung%2Fdotnet-calculation-engine/lists"}