UlrikenResult 22.2.23
See the version list below for details.
dotnet add package UlrikenResult --version 22.2.23
NuGet\Install-Package UlrikenResult -Version 22.2.23
<PackageReference Include="UlrikenResult" Version="22.2.23" />
paket add UlrikenResult --version 22.2.23
#r "nuget: UlrikenResult, 22.2.23"
// Install UlrikenResult as a Cake Addin
#addin nuget:?package=UlrikenResult&version=22.2.23
// Install UlrikenResult as a Cake Tool
#tool nuget:?package=UlrikenResult&version=22.2.23
UlrikenResult
What is it?
UlrikenResult is methods and extensions helping you writing c# in a more functional manner. It is my own helpers and extensions which I have collected into one assembly.
How can you use it?
The Result-class
The Result
-class is like the Either
-monad in Haskell. Combined with the static Do
-function
I can write code that handles exceptions. I use it like this:
public Result MyMethod(int aParameter) => Do.Try(()=>
{
// Do something wich throws an exception
});
public void CallMyMethod()
{
MyMethod(1)
.Then(()=> /* MyMethod didnt throw an exception */)
.Fail(r => /* MyMethod throw an exception, can be accessed in r.Exception */)
.Always(() => /* This code is always executed, even if MyMethod fails */);
}
The Do-class
The Do
-class is used as a wrapper around your methods. It's static, and you can add a logger to it so that
all exceptions are logged.
It has the following methods:
RaiseIf
void RaiseIf(Func<bool> func, string errorMessage)
This raises an application-exception with the given message if func is false.
void RaiseIf(Func<bool> func, Exception exception)
This raises the given exception if func is false.
Try
Result<T> Try<T>(Func<T> func, string messageOnFail = "", string logMessage = "")
Result Try(Action func, string messageOnFail = "", string logMessage = "")
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.1
- No dependencies.
-
.NETFramework 4.8
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net5.0
- No dependencies.
-
net6.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on UlrikenResult:
Package | Downloads |
---|---|
UlrikenLogger
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
22.3.21 | 444 | 3/21/2022 |
22.3.14 | 402 | 3/14/2022 |
22.2.23 | 431 | 2/23/2022 |
20.1.3 | 519 | 1/21/2020 |
20.1.2 | 452 | 1/15/2020 |
20.1.1 | 501 | 1/14/2020 |
20.1.0 | 522 | 1/14/2020 |
19.12.19.1 | 627 | 12/19/2019 |
19.12.12.1 | 556 | 12/12/2019 |
19.12.11.1 | 583 | 12/11/2019 |