{"id":20163723,"url":"https://github.com/emik03/emik.results","last_synced_at":"2026-01-25T18:02:39.959Z","repository":{"id":100294965,"uuid":"569288133","full_name":"Emik03/Emik.Results","owner":"Emik03","description":"Contains the Result type; A type representing either a success value or failure value.","archived":false,"fork":false,"pushed_at":"2024-10-15T21:40:28.000Z","size":363,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-25T23:55:17.611Z","etag":null,"topics":["csharp","csharp-library","dll"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Emik03.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"Emik03","custom":"https://paypal.me/emik03"}},"created_at":"2022-11-22T13:50:09.000Z","updated_at":"2024-10-15T21:40:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"f8ed942f-49f6-4790-a721-44141e813023","html_url":"https://github.com/Emik03/Emik.Results","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Emik03/Emik.Results","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Emik03%2FEmik.Results","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Emik03%2FEmik.Results/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Emik03%2FEmik.Results/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Emik03%2FEmik.Results/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Emik03","download_url":"https://codeload.github.com/Emik03/Emik.Results/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Emik03%2FEmik.Results/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28756432,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T16:32:25.380Z","status":"ssl_error","status_checked_at":"2026-01-25T16:32:09.189Z","response_time":113,"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":["csharp","csharp-library","dll"],"created_at":"2024-11-14T00:31:20.202Z","updated_at":"2026-01-25T18:02:39.939Z","avatar_url":"https://github.com/Emik03.png","language":"C#","funding_links":["https://github.com/sponsors/Emik03","https://paypal.me/emik03"],"categories":[],"sub_categories":[],"readme":"# Emik.Results\n\n[![NuGet package](https://img.shields.io/nuget/v/Emik.Results.svg?color=50fa7b\u0026logo=NuGet\u0026style=for-the-badge)](https://www.nuget.org/packages/Emik.Results)\n[![License](https://img.shields.io/github/license/Emik03/Emik.Results.svg?color=6272a4\u0026style=for-the-badge)](https://github.com/Emik03/Emik.Results/blob/main/LICENSE)\n\n`Result\u003cTOk, TErr\u003e` is the type used for returning and propagating errors. It is either `Ok`, representing success and containing a value, or `Err`, representing error and containing an error value.\n\nThis project has a dependency to [Emik.Morsels](https://github.com/Emik03/Emik.Morsels), if you are building this project, refer to its [README](https://github.com/Emik03/Emik.Morsels/blob/main/README.md) first.\n\n---\n\n- [Examples](#examples)\n- [Contribute](#contribute)\n- [License](#license)\n\n---\n\n## Examples\n\n```csharp\nusing System;\nusing System.Linq;\nusing Emik.Results;\nusing static Emik.Results.Please;\n\nT Throw\u003cT\u003e(T unused) =\u003e throw new();\n\n// Turn try-catch into a Result, and/or use operators to transform them.\nResult\u003cstring, Exception\u003e fail = \"foo\" \u0026 Try(Throw, \"bar\");\n\n// 'IsErr' guarantees each variant be non-null in their appropriate branches.\nstring value = fail.IsErr ? fail.Err.Message : fail.Ok;\n\n// You can also use the out parameter variant.\nvalue = fail.Out(out var str, out var exception) ? str : exception.Message;\n\n// Implements 'IEnumerable\u003cT\u003e', allowing for LINQ usage.\nint length = fail.Select(x =\u003e x.Length).ToArray();\n\n// Implements 'ISet\u003cT\u003e' as well, allowing for quering of other 'IEnumerable\u003cT\u003e' instances.\nvar thisIsTrue = Result.Ok(2).IsSupersetOf([2]);\n```\n\n```csharp\nusing System;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\nusing Emik.Results;\nusing Emik.Results.Extensions;\nusing static Emik.Results.Result;\n\n// Works with Tasks and ValueTasks too.\nResult\u003cint, Exception\u003e success = await Task\u003cint\u003e.FromResult(10).Try();\n\n// Works with Lazy.\nResult\u003cint, Exception\u003e failure = new Lazy\u003cint\u003e(() =\u003e throw new()).Try();\n\n// Convert nullable value types into Result.\nResult\u003cint, Unit\u003e none = default(int?).IntoOk();\n\n// Convert nullable reference types into Result.\nResult\u003cstring, Unit\u003e some = \"\".IntoOk();\n\n// Filter and map.\nvar thisIsAlsoTrue = Err(2).MapErr(x =\u003e new List\u003cint\u003e(x)).IsErrAnd(x =\u003e x is { Capacity: 2, Count: 0 });\n```\n\nFor a list of APIs, [click here](https://github.com/Emik03/Emik.Results/blob/main/Documentation/index.md).\n\n## Contribute\n\nIssues and pull requests are welcome to help this repository be the best it can be.\n\n## License\n\nThis repository falls under the [MPL-2 license](https://www.mozilla.org/en-US/MPL/2.0/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femik03%2Femik.results","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femik03%2Femik.results","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femik03%2Femik.results/lists"}