Late4dTrain.Result 0.0.3-pre

This is a prerelease version of Late4dTrain.Result.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Late4dTrain.Result --version 0.0.3-pre
NuGet\Install-Package Late4dTrain.Result -Version 0.0.3-pre
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Late4dTrain.Result" Version="0.0.3-pre" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Late4dTrain.Result --version 0.0.3-pre
#r "nuget: Late4dTrain.Result, 0.0.3-pre"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Late4dTrain.Result as a Cake Addin
#addin nuget:?package=Late4dTrain.Result&version=0.0.3-pre&prerelease

// Install Late4dTrain.Result as a Cake Tool
#tool nuget:?package=Late4dTrain.Result&version=0.0.3-pre&prerelease

Late4dTrain.Result

.NET Release to Nuget NuGet version (GSoulavy.Csv.Net)

Result Object

using static Late4dTrain.Result<Error>; // 👀

void Main()
{
	// 1.) void success scenario
	var ok = GetOk();

	ok
	   .OnSuccess(OnSuccess) // will execute without params
	   .OnFailure(OnFailure); // wont execute

	if (ok.IsSuccess) { Console.WriteLine("No corresponding Value property"); }

	// 2.) int success scenario
	var okWithData = GetOkWithData();

	okWithData
	.OnSuccess(OnSuccessWithValue) // will execute with value passed in
	.OnFailure(OnFailure); // wont execute

	if (okWithData.IsSuccess)
		Console.WriteLine($"Success: {okWithData.Value}");

	// 3.) void failed scenario
	var failed = GetFailed();

	failed
		.OnSuccess(OnSuccess) // wont executed
		.OnFailure(OnFailure); // will execute with error passed in

	if (!failed.IsSuccess)
		Console.WriteLine($"Failed: {failed.Error.Message}");

	// 4.) int failed scenario
	var failedWithData = GetFailedWithData();
	
	failedWithData
		.OnSuccess(OnSuccessWithValue) // won't execute
		.OnFailure(OnFailure);
		
	if (!failed.IsSuccess)
		Console.WriteLine($"Failed: {failed.Error.Message}");
		
	// Exception throws, when it is quite obvious
	
	Console.WriteLine(ok.Error); // don't have error when it is successful
	Console.WriteLine(okWithData.Error); // don't have error when it is successful
	Console.WriteLine(failedWithData.Value); // don't have value when it is failed
}

public Result<Error> GetOk() => Ok();

public Result<int, Error> GetOkWithData() => Ok(42);

public Result<Error> GetFailed() => Fail(new Error("Very bad!"));
	
public Result<int, Error> GetFailedWithData() => Fail<int>(new Error("Failed, though I was expecting a value"));	


// Handlers
public void OnSuccess()
{
	Console.WriteLine("onSuccess, when it is void scenario");
}

public void OnSuccessWithValue(int value)
{
	Console.WriteLine($"onSuccess with expected value: {value}");
}

public void OnFailure(Error error)
{
	Console.WriteLine($"onFailure with error message: {error.Message}");
}

// Custom Error Object
public class Error
{
	public string Message { get; }

	public Error(string message)
	{
		Message = message;
	}
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  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 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net6.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Late4dTrain.Result:

Package Downloads
Late4dTrain.CosmosDbStorage

Simple cosmosDb storage adapter

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 121 6/21/2023
1.0.0 106 6/21/2023
0.0.4-pre 153 2/17/2022
0.0.3-pre 175 1/24/2022
0.0.2-pre 137 1/21/2022