meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
z0ne.maybe:start [2022-05-05 14:46]
Kura typo
z0ne.maybe:start [2022-05-05 15:01]
Kura
Line 2: Line 2:
 {{:z0ne.maybe:logo.png?75 |Z0ne.Maybe Logo}} {{:z0ne.maybe:logo.png?75 |Z0ne.Maybe Logo}}
 [[gt>z0ne/Z0ne.Maybe|Z0ne.Maybe]]  brings one feature of functional programming into the world of C# and .Net: Optionals.   [[gt>z0ne/Z0ne.Maybe|Z0ne.Maybe]]  brings one feature of functional programming into the world of C# and .Net: Optionals.  
-They are most often referred to as `optionor `maybe`.+They are most often referred to as ''option'' or ''maybe''.
  
 This library is being developed alongside a product with my [[https://tiplu.de|company]] and will be extended alongside real world requirements of our repertoire.  This library is being developed alongside a product with my [[https://tiplu.de|company]] and will be extended alongside real world requirements of our repertoire. 
  
 ===== Getting Started ===== ===== Getting Started =====
-  - Add the [Z0ne.Maybe nuget package](https://www.nuget.org/packages/Z0ne.Maybe/to your project. +  - Add the [[nuget>Z0ne.Maybe|Z0ne.Maybe nuget package]to your project. 
-  - Create an instance by calliing `Maybe.A``Maybe.Just`, or `Maybe.Nothing`+  - Create an instance by calliing ''Maybe.A''''Maybe.Just'', or ''Maybe.Nothing''
-  - Use the provided methods (e.g.: `Match``Do``DoWhenNothing``DoJust`) to work with the instance. +  - Use the provided methods (e.g.: ''Match''''Do''''DoWhenNothing''''DoWhenJust'') to work with the instance. 
-  - For additional async functionality, add the [Z0ne.Async nuget package](https://www.nuget.org/packages/Z0ne.Async/to your project.+  - For additional async functionality, add the [[nuget>Z0ne.Maybe.Async|Z0ne.Maybe.Async nuget package]to your project.
  
 ==== Common Tasks ==== ==== Common Tasks ====
Line 66: Line 66:
 var d = maybe.Where(val => false); var d = maybe.Where(val => false);
  
-// flatten the (nested) value (if maybe's are nested just return the inner most value)+// collapse to the innermost value (if maybe's are nested just return the inner most maybe)
 var e = maybe.Flatten(); var e = maybe.Flatten();
 </code> </code>
Line 95: Line 95:
 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 when the inner type is a class with a new() constructor)
 var e = maybe.UnwrapOrNew(); var e = maybe.UnwrapOrNew();
 </code> </code>
Line 108: Line 108:
  
 === Async === === Async ===
-Many methods listed above exist as async methods. They need the [Z0ne.Maybe.Async nuget package](https://www.nuget.org/packages/Z0ne.Maybe.Async/).+Many methods listed above exist as async methods. They need the [[nuget>Z0ne.Maybe.Async|Z0ne.Maybe.Async nuget package]].
  
-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 ''Task'', but the callbacks are async functions. **Await**: The maybe is not wrapped in a ''Task'', but the callbacks are async functions.