Chasm.Utilities 2.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Chasm.Utilities --version 2.1.0                
NuGet\Install-Package Chasm.Utilities -Version 2.1.0                
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="Chasm.Utilities" Version="2.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Chasm.Utilities --version 2.1.0                
#r "nuget: Chasm.Utilities, 2.1.0"                
#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 Chasm.Utilities as a Cake Addin
#addin nuget:?package=Chasm.Utilities&version=2.1.0

// Install Chasm.Utilities as a Cake Tool
#tool nuget:?package=Chasm.Utilities&version=2.1.0                

Chasm.Utilities

Provides various utility types and methods.

Util

Contains Fail and Catch utility methods, that can be used to shorten common branch code. (or... you could also just not use the auto-formatting, and write everything in a single line, but that's not my style)

Util.Fail sets all out parameters to default and returns either false or a specified return value. Especially useful for parsing.

// Commonly written as:
if (stringIsInvalid) { result = null; return ErrorCode.InvalidString; }

// Using Util.Fail:
if (stringIsInvalid) return Util.Fail(ErrorCode.InvalidString, out result);

Util.Catch catches an exception thrown by the specified delegate. If the delegate returned a value, it can be read through an out parameter.

// Commonly written as:
object? result; Exception? ex;
try { result = doSomething(); ex = null; }
catch (Exception caught) { result = null; ex = caught; }

// Using Util.Catch:
var ex = Util.Catch(doSomething, out object? result);

Util.Is can be used to assign a type-casted value to an existing variable.

// Commonly written as:
if (a is string textA) { /* ... */ }
else if (b is string textB) { /* ... */ }
else if (c is string textC) { /* ... */ }

// Using Util.Is:
if (a is string text) { /* ... */ }
else if (Util.Is(b, out text)) { /* ... */ }
else if (Util.Is(c, out text)) { /* ... */ }
Product 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 is compatible.  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 netcoreapp3.0 was computed.  netcoreapp3.1 is compatible. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen 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.
  • .NETCoreApp 3.1

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.5.2 103 9/28/2024
2.5.1 122 9/6/2024
2.5.0 103 9/6/2024
2.4.0 105 9/5/2024
2.3.7 73 7/30/2024
2.3.6 99 6/11/2024
2.3.5 104 6/7/2024
2.3.4 113 5/9/2024
2.3.3 309 1/2/2024
2.3.2 176 1/1/2024
2.3.1 145 12/30/2023
2.3.0 125 12/29/2023
2.2.0 128 12/17/2023
2.1.0 126 12/16/2023
2.0.0 132 12/16/2023