{"id":23693240,"url":"https://github.com/stillpoint-software/hyperbee.expressions","last_synced_at":"2026-01-21T21:15:35.518Z","repository":{"id":266719940,"uuid":"848910367","full_name":"Stillpoint-Software/hyperbee.expressions","owner":"Stillpoint-Software","description":"C# library that extends the capabilities of expression trees to handle asynchronous workflows and other language constructs.","archived":false,"fork":false,"pushed_at":"2025-12-29T14:57:41.000Z","size":1163,"stargazers_count":7,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-01-01T13:18:14.174Z","etag":null,"topics":["async","await","csharp","dotnet","expression-extension","expression-tree","expressions"],"latest_commit_sha":null,"homepage":"https://stillpoint-software.github.io/hyperbee.expressions/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Stillpoint-Software.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":"2024-08-28T16:21:36.000Z","updated_at":"2025-12-29T14:48:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"a2614f53-cdf4-4bac-8dbf-fc75af38f636","html_url":"https://github.com/Stillpoint-Software/hyperbee.expressions","commit_stats":null,"previous_names":["stillpoint-software/hyperbee.expressions"],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/Stillpoint-Software/hyperbee.expressions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stillpoint-Software%2Fhyperbee.expressions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stillpoint-Software%2Fhyperbee.expressions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stillpoint-Software%2Fhyperbee.expressions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stillpoint-Software%2Fhyperbee.expressions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Stillpoint-Software","download_url":"https://codeload.github.com/Stillpoint-Software/hyperbee.expressions/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stillpoint-Software%2Fhyperbee.expressions/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28643240,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T18:04:35.752Z","status":"ssl_error","status_checked_at":"2026-01-21T18:03:55.054Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["async","await","csharp","dotnet","expression-extension","expression-tree","expressions"],"created_at":"2024-12-30T03:50:42.974Z","updated_at":"2026-01-21T21:15:35.499Z","avatar_url":"https://github.com/Stillpoint-Software.png","language":"C#","readme":"﻿# Welcome to Hyperbee Expressions\n\n`Hyperbee.Expressions` is a library for creating c# expression trees that extend the capabilities of standard expression \ntrees to handle asynchronous workflows and other language constructs.\n\n## Features\n\n* **Async Expressions**\n    * `AwaitExpression`: An expression that represents an await operation.\n    * `AsyncBlockExpression`: An expression that represents an asynchronous code block.\n\n* **Yield Expressions**\n    * `YieldExpression`: An expression that represents a yield return or break statement.\n    * `EnumerableBlockExpression`: An expression that represents an enumerable code block.\n\n* **Using Expression**\n    * `UsingExpression`: An expression that automatically disposes IDisposable resources.\n\n* **Looping Expressions**\n    * `WhileExpression`: An expression that represents a while loop.\n    * `ForExpression`: An expression that represents a for loop.\n    * `ForEachExpression`: An expression that represents a foreach loop.\n\n* **Other Expressions**\n    * `StringFormatExpression`: An expression that creates a string using a supplied format string and parameters.\n    * `ConfigurationExpression`: An expression that allows access to IConfiguration.\n    * `InjectExpression`: An expression that allows for depency inject from a IServiceProvider.\n    * `DebugExpression`: An expression that helps when debugging expression trees.\n\n* Supports Fast Expression Compiler (FEC) for improved performance.\n\n* Supports interpreted expression trees using `lambda.Compile(preferInterpretation: true)`. \n    ```csharp\n    var lambda = Expression.Lambda\u003cFunc\u003cint\u003e\u003e(Expression.Constant(1));\n    var interpetedLambda = lambda.Compile(preferInterpretation: true);\n    ```\n\n## Examples\n\n### Asynchronous Expressions\n\nThe following example demonstrates how to create an asynchronous expression tree.\n\nWhen the expression tree is compiled, the `AsyncBlockExpression` will auto-generate a state machine that executes \n`AwaitExpressions` in the block asynchronously.\n\n```csharp\n\npublic class Example\n{\n    public async Task ExampleAsync()\n    {\n        // Create an async block that calls async methods and assigns their results\n        var instance = Constant( this );\n        var result1 = Variable( typeof(int), \"result1\" );\n        var result2 = Variable( typeof(int), \"result2\" );\n\n        var asyncBlock = BlockAsync(\n            [result1, result2],\n            Assign( result1, Await(\n                Call( instance, nameof(FirstAsyncMethod), Type.EmptyTypes )\n            ) ),\n            Assign( result2, Await(\n                Call( instance, nameof(SecondAsyncMethod), Type.EmptyTypes, result1 )\n            ) )\n        );\n\n        // Compile and execute the async block\n        var lambda = Lambda\u003cFunc\u003cTask\u003cint\u003e\u003e\u003e( asyncBlock );\n        var compiledLambda = lambda.Compile();\n        var resultValue2 = await compiledLambda();\n\n        Console.WriteLine( $\"Second async method result: {resultValue2}\" );\n    }\n\n    public static async Task\u003cint\u003e FirstAsyncMethod()\n    {\n        await Task.Delay( 1000 ); // Simulate async work\n        return 42; // Example result\n    }\n\n    public static async Task\u003cint\u003e SecondAsyncMethod( int value )\n    {\n        await Task.Delay( 1000 ); // Simulate async work\n        return value * 2; // Example result\n    }\n}\n```\n\n### Yield Expressions\n\nThe following example demonstrates how to create a yield expression tree.\n\nWhen the expression tree is compiled, the `EnumerableBlockExpression` will auto-generate a state machine that executes\n`YieldExpressions` in the block.\n\n```csharp\npublic class Example\n{\n    public void ExampleYield()\n    {\n        // Create an enumerable block that yields values\n        var index = Variable( typeof(int), \"index\" );\n\n        var enumerableBlock = BlockEnumerable(\n            [index],\n            For( Assign( index, Constant( 0 ) ), LessThan( index, Constant( 10 ) ), PostIncrementAssign( index ),\n                Yield( index )\n            )\n        );\n\n        // Compile and execute the enumerable block\n        var lambda = Lambda\u003cFunc\u003cIEnumerable\u003cint\u003e\u003e\u003e( enumerableBlock );\n        var compiledLambda = lambda.Compile();\n        var enumerable = compiledLambda();\n\n        foreach( var value in enumerable )\n        {\n            Console.WriteLine( $\"Yielded value: {value}\" );\n        }\n    }\n}\n```\n\n### Using Expression\n\nThe following example demonstrates how to create a Using expression.\n\n```csharp\npublic class Example\n{\n    private class DisposableResource : IDisposable\n    {\n        public bool IsDisposed { get; private set; }\n        public void Dispose() =\u003e IsDisposed = true;\n    }\n\n    public void ExampleUsing()\n    {\n        var resource = new TestDisposableResource();\n\n        var disposableExpression = Expression.Constant( resource, typeof( TestDisposableResource ) );\n        var bodyExpression = Expression.Empty(); // Actual body isn't important\n\n        var usingExpression = ExpressionExtensions.Using( \n            disposableExpression, \n            bodyExpression \n        );\n\n        var compiledLambda = Expression.Lambda\u003cAction\u003e( reducedExpression ).Compile();\n\n        compiledLambda();\n\n        Console.WriteLine( $\"Resource was disposed {resource.IsDisposed}.\" );\n    }\n}\n```\n\n## Credits\n\nSpecial thanks to:\n\n- Sergey Tepliakov - [Dissecting the async methods in C#](https://devblogs.microsoft.com/premier-developer/dissecting-the-async-methods-in-c/).\n- [Fast Expression Compiler](https://github.com/dadhi/FastExpressionCompiler) for improved performance. :heart:\n- [Just The Docs](https://github.com/just-the-docs/just-the-docs) for the documentation theme.\n\n## Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](https://github.com/Stillpoint-Software/.github/blob/main/.github/CONTRIBUTING.md) \nfor more details\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstillpoint-software%2Fhyperbee.expressions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstillpoint-software%2Fhyperbee.expressions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstillpoint-software%2Fhyperbee.expressions/lists"}