meta data for this page
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
z0ne.maybe:start [2022-05-05 14:48] Kura |
z0ne.maybe:start [2022-05-31 13:37] (current) Kura |
||
---|---|---|---|
Line 2: | Line 2: | ||
{{: | {{: | ||
[[gt> | [[gt> | ||
- | They are most often referred to as `option` or `maybe`. | + | They are most often referred to as '' |
This library is being developed alongside a product with my [[https:// | This library is being developed alongside a product with my [[https:// | ||
+ | |||
+ | The changelog is available [[z0ne.maybe: | ||
===== Getting Started ===== | ===== Getting Started ===== | ||
- | - Add the [Z0ne.Maybe nuget package](https:// | + | - Add the [[nuget> |
- | - Create an instance by calliing | + | - Create an instance by calliing |
- | - Use the provided methods (e.g.: | + | - Use the provided methods (e.g.: |
- | - For additional async functionality, | + | - For additional async functionality, |
==== Common Tasks ==== | ==== Common Tasks ==== | ||
Line 66: | Line 68: | ||
var d = maybe.Where(val => false); | var d = maybe.Where(val => false); | ||
- | // flatten | + | // collapse to the innermost |
var e = maybe.Flatten(); | var e = maybe.Flatten(); | ||
</ | </ | ||
Line 95: | Line 97: | ||
var d = maybe.UnwrapOrElse(() => 1); | var d = maybe.UnwrapOrElse(() => 1); | ||
- | // get the inner value, or create a new instance (only when the inner type is a class with a new() constructor) | + | // get the inner value, or create a new instance (only available |
var e = maybe.UnwrapOrNew(); | var e = maybe.UnwrapOrNew(); | ||
</ | </ | ||
Line 108: | Line 110: | ||
=== Async === | === Async === | ||
- | Many methods listed above exist as async methods. They need the [Z0ne.Maybe.Async | + | Many methods listed above exist as async methods. They need the [[nuget>Z0ne.Maybe.Async|Z0ne.Maybe.Async |
- | Every method must be awauted, The Suffix of the method name describe its operation: | + | Every method must be awaited, The Suffix of the method name describe its operation: |
**Await**: The maybe is not wrapped in a '' | **Await**: The maybe is not wrapped in a '' |