Skip to content

Commit a1d98c9

Browse files
committed
Update Maybe/README.md.
Release note for 0.2.0.
1 parent cbb7985 commit a1d98c9

File tree

2 files changed

+30
-12
lines changed

2 files changed

+30
-12
lines changed

src/Here/Here.csproj

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,14 @@ Supported platforms:
2222
<Company>Alexandre Rabérin</Company>
2323
<IsPackable>true</IsPackable>
2424
<PackageId>Here</PackageId>
25-
<PackageReleaseNotes>➟ Release 0.1.0
26-
- General:
27-
- Add JetBrains annotations on many methods of the library to clarify them.
28-
25+
<PackageReleaseNotes>➟ Release 0.2.0
2926
- For Maybe:
30-
- Supports bitwise and logical AND and OR operators.
31-
- New IfElse extensions.
32-
- New Linq extension (OfType) and simplify usage of Cast too.
33-
- Try parse now are available with custom arguments like those available in .NET Framework.
34-
35-
- For Result:
36-
- First implementation of Result.</PackageReleaseNotes>
27+
- Little optimizations
28+
- New IfOr and ElseOr extensions.
29+
- Easy conversions between numeric Maybe (ToInt(), ToLong(), ToDouble(), etc.)
30+
- Conversion from numeric Maybe to Maybe&lt;bool&gt;.
31+
- Try Get Value for dictionaries supports null key queries.
32+
- Try Get Value for dictionary&lt;TKey, object&gt; supports value cast to an expected type.</PackageReleaseNotes>
3733
<PackageTags>Here Functional C# Maybe Monad Result</PackageTags>
3834
<PackageLicenseUrl>https://opensource.org/licenses/MIT</PackageLicenseUrl>
3935
<PackageProjectUrl>https://github.com/KeRNeLith/Here</PackageProjectUrl>

src/Here/Maybe/README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,4 +214,26 @@ public static Func<TInput, Maybe<TValue>> CreateParse<TInput, TValue>([NotNull]
214214
}
215215
```
216216

217-
And use them for each basic type, but you can also create you own implementation in the same way.
217+
And use them for each basic type, but you can also create you own implementation in the same way.
218+
219+
### Numeric Types casts
220+
221+
Each numeric type, which means `byte`, `sbyte`, `short`, `ushort`, `int`, `uint`, `long`, `ulong`, `decimal`, `float` and `double` have support of the conversion to another numeric type and also to `bool`.
222+
223+
This means that you can easily convert `Maybe<TNumeric>` to a `Maybe<TOtherNumeric>` or `Maybe<bool>`. Each `Maybe<TNumeric>` have extensions to do this. Here are some examples:
224+
225+
```csharp
226+
Maybe<double> maybeDouble = Maybe<double>.Some(42.2d);
227+
228+
// Double to bool
229+
Maybe<bool> maybeBool = maybeDouble.ToBool(); // True
230+
231+
// Double to int
232+
Maybe<int> maybeInt = maybeDouble.ToInt(); // 42
233+
234+
// Etc.
235+
236+
// As a consequence you can chain calls like this:
237+
string myString = "51.52";
238+
Maybe<double> maybeDouble = myString.TryParseInt().ToDouble(); // 51
239+
```

0 commit comments

Comments
 (0)