-
Notifications
You must be signed in to change notification settings - Fork 0
FAQ
It's a simple design idea: instead of throwing an exception when something fails, a method returns an object that says "this succeeded" or "this failed, and here is why." This makes error handling explicit and visible in your code, instead of hidden inside exceptions.
Yes. Resultron is a .NET library written in C#, and it targets .NET 10.
No. Resultron is best for expected failures — things like "invalid input," "not found," or "already exists," which are a normal part of your business logic. Real, unexpected exceptions (like a bug, or a server crashing) can still be thrown and caught normally. Resultron's Try/TryAsync methods simply give you an easy way to convert an exception into a Result when you want to.
-
Result: for operations with no return value (success or failure only). Example: deleting a record. -
Result<T>: for operations that return a value on success. Example: fetching a user (Result<User>).
-
Map: use it for a step that is a plain function and cannot fail on its own (like turning a number into text). -
Bind: use it for a step that already returns aResult/Result<T>(a step that can succeed or fail by itself).
See Chaining with Map and Bind for more details and examples.
You will get the default value for that type (for example null for a class, 0 for an int), not an exception. This is why you should always check IsSuccess (or use Match) before reading .Value, so you don't accidentally use a meaningless default value.
No. Resultron checks this internally and will throw an ArgumentException if you try. A result must either be:
- Successful, with
Error.None, or - Failed, with a real
Error.
This keeps every Result object trustworthy and consistent.
Yes, through Result.TryAsync and Result<T>.TryAsync. See Async Operations.
These are features mentioned in the project's short description as part of its vision, but they are not yet available in the current version of the source code. This wiki documents the features that exist today: Result, Result<T>, Error, Try/TryAsync, Map, Bind, and Match. Check the project's CHANGELOG for the latest updates.
Check the Full Example page, or look at the sample/Resultron.Sample folder in the repository.
Yes. It is released under the MIT License, which allows free use, modification, and distribution, including in commercial projects.
See the project's CONTRIBUTING.md and CODE_OF_CONDUCT.md files in the repository. Bug reports and feature requests can be opened as GitHub Issues.