{"id":37039342,"url":"https://github.com/adomorn/resultant","last_synced_at":"2026-01-14T04:39:58.385Z","repository":{"id":212808702,"uuid":"732351590","full_name":"adomorn/Resultant","owner":"adomorn","description":"A C# library that elegantly handles operation results with support for error aggregation, async operations, and more, following the Result pattern.","archived":false,"fork":false,"pushed_at":"2023-12-17T14:37:36.000Z","size":79,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-30T05:16:03.374Z","etag":null,"topics":["async","async-await","chsarp","dotnet","errorhandling","fluentapi","opensource","result-pattern"],"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/adomorn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-12-16T11:46:20.000Z","updated_at":"2024-10-28T13:43:59.000Z","dependencies_parsed_at":"2024-01-02T11:04:28.257Z","dependency_job_id":null,"html_url":"https://github.com/adomorn/Resultant","commit_stats":{"total_commits":27,"total_committers":2,"mean_commits":13.5,"dds":0.2592592592592593,"last_synced_commit":"c798f10bf08e532bab6f5b698e5dd63c34b21520"},"previous_names":["adomorn/resultant"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/adomorn/Resultant","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adomorn%2FResultant","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adomorn%2FResultant/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adomorn%2FResultant/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adomorn%2FResultant/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adomorn","download_url":"https://codeload.github.com/adomorn/Resultant/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adomorn%2FResultant/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28409729,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","async-await","chsarp","dotnet","errorhandling","fluentapi","opensource","result-pattern"],"created_at":"2026-01-14T04:39:57.738Z","updated_at":"2026-01-14T04:39:58.372Z","avatar_url":"https://github.com/adomorn.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Resultant\n\nResultant is a robust and flexible C# library designed for implementing the Result pattern, enhancing error handling in .NET applications. It offers a structured way to return success or error information, making your code more readable, maintainable, and less prone to errors.\n\n## Features\n\n- **Generic and Non-Generic Result Types**: Handle operations with and without return values.\n- **Fluent API**: Chain operations for readability and efficiency.\n- **Async Support**: Seamlessly integrate with async methods.\n- **Error Handling**: Advanced error handling with messages, codes, and multiple errors.\n- **Paged Results**: Special handling for operations returning paginated data.\n- **Implicit Conversion Operators**: Simplify usage with intuitive type conversions.\n\n## Getting Started\n\n### Installation\n\nInstall Resultant via NuGet:\n\n```shell\ndotnet add package Resultant\n```\n\n### Basic Usage\n\n#### Creating a Successful Result\n\n```csharp\nvar successResult = Result.Ok();\nvar successResultWithValue = Result.Ok(\"Success value\");\n```\n\n#### Creating a Failure Result\n\n```csharp\nvar failResult = Result.Fail(\"Error message\");\nvar failResultWithCode = Result.Fail(new Error(\"Error message\", errorCode));\n```\n\n#### Working with Result\n\n```csharp\npublic Result\u003cstring\u003e GetData()\n{\n    if (someCondition)\n        return Result.Fail(\"Error occurred\");\n\n    return Result.Ok(\"Data\");\n}\n\nvar result = GetData();\nif (result.IsSuccess)\n{\n    Console.WriteLine(result.Value); // Use the data\n}\nelse\n{\n    Console.WriteLine(result.Error); // Handle the error\n}\n```\n\n#### Using Async Methods\n\n```csharp\npublic async Task\u003cResult\u003cstring\u003e\u003e GetDataAsync()\n{\n    // Async operation...\n    return await Result.Ok(\"Async data\");\n}\n\n// Usage\nvar result = await GetDataAsync();\n```\n\n\n#### Fluent API with Map and Bind\n\nThe `Map` and `Bind` methods provide a fluent way to transform and chain result operations.\n\n- **Map**: Use this method to transform the value of a successful result. It doesn't execute if the result is a failure.\n\n```csharp\npublic Result\u003cint\u003e ParseData(string data)\n{\n    if (int.TryParse(data, out var number))\n        return Result.Ok(number);\n    return Result.Fail(\"Invalid data\");\n}\n\nvar result = Result.Ok(\"123\").Map(ParseData);\n// If parsing succeeds, 'result' is a successful Result\u003cint\u003e\n```\n\n- **Bind**: Use this method to chain results, where each result depends on the previous one.\n\n```csharp\npublic Result\u003cstring\u003e FetchData(int id)\n{\n    // Fetch data logic...\n    return Result.Ok(\"Fetched data\");\n}\n\npublic Result\u003cstring\u003e ProcessData(string data)\n{\n    // Data processing logic...\n    return Result.Ok(\"Processed data\");\n}\n\nvar result = Result.Ok(1)\n    .Bind(FetchData)   // Fetch data with the id\n    .Bind(ProcessData); // Then process the fetched data\n// 'result' holds the final result of these chained operations\n```\n\n\n```csharp\npublic Result\u003cint\u003e ParseData(string data)\n{\n    if (int.TryParse(data, out var number))\n        return Result.Ok(number);\n\n    return Result.Fail(\"Invalid data\");\n}\n\nvar result = Result.Ok(\"123\").Map(ParseData);\n```\n\n## Advanced Topics\n\n### Handling Paged Results\n\n```csharp\npublic PagedResult\u003cItem\u003e GetItems(int page, int pageSize)\n{\n    var items = FetchItems(page, pageSize); // Your logic to fetch items\n    return PagedResult\u003cItem\u003e.Create(items, page, pageSize, totalItemCount);\n}\n```\n\n### Combining Results\n\nUse `Result.Combine` to aggregate multiple results into one.\n\n### Error Handling\n\nCustomize error handling by using the `Error` class to include error codes and detailed messages.\n\n## Contributing\n\nContributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.\n\nCheck out our [contributing guidelines](https://github.com/adomorn/Resultant/blob/master/CONTRIBUTING.md) for more information.\n\n## License\n\nDistributed under the MIT License. See [LICENSE](https://github.com/adomorn/Resultant/blob/master/LICENSE.txt) for more information.\n\n## Contact\n\nArda Terekeci - [@ardaterekeci](https://www.linkedin.com/in/ardaterekeci/)\n\nProject Link: [https://github.com/adomorn/Resultant](https://github.com/adomorn/Resultant)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadomorn%2Fresultant","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadomorn%2Fresultant","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadomorn%2Fresultant/lists"}