{"id":16639404,"url":"https://github.com/bruce-dunwiddie/data-eval","last_synced_at":"2026-03-10T13:33:27.586Z","repository":{"id":55558441,"uuid":"201545206","full_name":"bruce-dunwiddie/data-eval","owner":"bruce-dunwiddie","description":".Net Library for Evaluating Expressions at Runtime","archived":false,"fork":false,"pushed_at":"2024-12-31T08:36:44.000Z","size":273,"stargazers_count":14,"open_issues_count":5,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-02-14T20:54:14.636Z","etag":null,"topics":["compile","data-eval","eval","evaluating-expressions","evaluator"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bruce-dunwiddie.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-08-09T21:54:01.000Z","updated_at":"2024-12-31T08:33:52.000Z","dependencies_parsed_at":"2024-10-12T07:06:01.646Z","dependency_job_id":"4bf75135-d497-469d-9bb2-525b2ed096fe","html_url":"https://github.com/bruce-dunwiddie/data-eval","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/bruce-dunwiddie/data-eval","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bruce-dunwiddie%2Fdata-eval","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bruce-dunwiddie%2Fdata-eval/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bruce-dunwiddie%2Fdata-eval/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bruce-dunwiddie%2Fdata-eval/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bruce-dunwiddie","download_url":"https://codeload.github.com/bruce-dunwiddie/data-eval/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bruce-dunwiddie%2Fdata-eval/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30334675,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T12:41:07.687Z","status":"ssl_error","status_checked_at":"2026-03-10T12:41:06.728Z","response_time":106,"last_error":"SSL_read: 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":["compile","data-eval","eval","evaluating-expressions","evaluator"],"created_at":"2024-10-12T07:05:59.087Z","updated_at":"2026-03-10T13:33:27.555Z","avatar_url":"https://github.com/bruce-dunwiddie.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# data-eval\n.Net Library for Evaluating Expressions at Runtime\n\nThe goal of this library is to set up a fully featured easy interface for working with C# based expressions as strings with access to as much C# and .Net functionality as possible, with the highest performance and compatibility as possible.\n\nString expressions allow application functionality to be added and modified outside of the application, even viewed and possibly edited by business users with limited technical knowledge.\n\nAvailable on Nuget, [Data.Eval](https://www.nuget.org/packages/Data.Eval/).\n\n    Install-Package Data.Eval\n\n\n[![NuGet](https://img.shields.io/nuget/dt/Data.Eval.svg)](https://www.nuget.org/packages/Data.Eval/)\n\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n[![Build status](https://ci.appveyor.com/api/projects/status/ewhl0xxqok5yeqr3?svg=true)](https://ci.appveyor.com/project/bruce-dunwiddie/data-eval)\n\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=data-eval\u0026metric=coverage)](https://sonarcloud.io/component_measures?id=data-eval\u0026metric=coverage)\n\n### Class Documentation\n- [bruce-dunwiddie.github.io/data-eval/](\u003chttp://bruce-dunwiddie.github.io/data-eval/html/T_Data_Eval_Evaluator.htm\u003e)\n\n### Simple Addition\n\nCode:\n```csharp\nConsole.WriteLine(Evaluator.Eval(\"return 1+1\"));\n```\n\nResult:\n```\n2\n```\n\n[.Net Fiddle](https://dotnetfiddle.net/DTLu6Z)\n\n### Variable Addition\n\nCode:\n```csharp\nvar evaluator = new Evaluator(\"return x+y\");\nevaluator[\"x\"] = 1;\nevaluator[\"y\"] = 2;\nConsole.WriteLine(\"Result: \" + evaluator.Eval());\n```\n\nResult:\n```\nResult: 3\n```\n\n[.Net Fiddle](https://dotnetfiddle.net/19moI3)\n\n### Variable Updates With No Return\n\nCode:\n```csharp\nvar evaluator = new Evaluator(\"x++\");\nevaluator[\"x\"] = 1;\nevaluator.Exec();\nConsole.WriteLine(\"Result: \" + evaluator[\"x\"]);\n```\n\nResult:\n```\nResult: 2\n```\n\n[.Net Fiddle](https://dotnetfiddle.net/K30Ht3)\n\n### Expressions With External Code\n\nCode:\n```csharp\n// you can reference external code from inside an expression\nvar eval = new Evaluator(\"message = ExampleClass.HelloWorld\");\n\n// add a reference to the external code by specifying the path to the dll\neval.AddReference(typeof(TestExternalReference.ExampleClass).Assembly.Location);\n\n// can add usings to simplify expression\neval.AddUsing(\"TestExternalReference\");\n\n// define the holder variable by assigning it a default value\neval[\"message\"] = \"\";\n\n// execute expression and set the variable\neval.Exec();\n\n// write out Hello World\nConsole.WriteLine(eval[\"message\"]);\n```\n\nResult:\n```\nHello World\n```\n\n### Add Callable Method\n\nCode:\n```csharp\nEvaluator eval = new Evaluator(\"return IsFutureDate(date)\");\n\neval.AddMethod(@\"\n\tbool IsFutureDate(string date)\n\t{\n\t\tDateTime parsedDate;\n\n\t\tbool parsed = DateTime.TryParse(date, out parsedDate);\n\n\t\treturn parsed \u0026\u0026 parsedDate \u003e DateTime.Now;\n\t}\");\n\neval[\"date\"] = \"1/1/1900\";\n\nConsole.WriteLine(eval.Eval\u003cbool\u003e());\n```\n\nResult:\n```\nFalse\n```\n\n[.Net Fiddle](https://dotnetfiddle.net/zHq8VW)\n\n### Speed\n\nFor maximal speed, instances of the Evaluator class should be created with static strings referencing variables and be reused by just changing the value of the referenced variables, instead of dynamically changing the expression or creating new Evaluator instances, e.g.\n\nCode:\n```csharp\nList\u003cCustomer\u003e customers = new List\u003cCustomer\u003e()\n{\n\tnew Customer()\n\t{\n\t\tID = 1,\n\t\tFirstName = \"John\",\n\t\tLastName = \"Smith\",\n\t\tOrderCount = 6,\n\t\tTotalSales = 75000\n\t},\n\tnew Customer()\n\t{\n\t\tID = 2,\n\t\tFirstName = \"Bob\",\n\t\tLastName = \"Jones\",\n\t\tOrderCount = 3,\n\t\tTotalSales = 25000\n\t}\n};\n\nEvaluator highValuedCheck = new Evaluator(\n\t// can now have this rule be editable outside of the application\n\t\"return customer.OrderCount \u003e= 5 || customer.TotalSales \u003e= 100000\");\n\nList\u003cCustomer\u003e highValuedCustomers = customers.Where(\n\tc =\u003e {\n\n\t\thighValuedCheck[\"customer\"] = c;\n\n\t\treturn highValuedCheck.Eval\u003cbool\u003e();\n\n\t}).ToList();\n```\n\n#### .Net Framework\n\n- 18 million evaluations per second\n- 4.5 million evaluations per second with one referenced variable\n- 50 compilations of new expressions per second\n- 200 thousand evaluations per second when creating new Evaluator instances each time but on a previously seen expression\n\n#### .Net Core\n\n- 28 million evaluations per second\n- 4 million evaluations per second with one referenced variable\n- 50 compilations of new expressions per second\n- 400 thousand evaluations per second when creating new Evaluator instances each time but on a previously seen expression\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbruce-dunwiddie%2Fdata-eval","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbruce-dunwiddie%2Fdata-eval","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbruce-dunwiddie%2Fdata-eval/lists"}