OwlDomain.Common.Throw 2.0.1

Prefix Reserved
dotnet add package OwlDomain.Common.Throw --version 2.0.1                
NuGet\Install-Package OwlDomain.Common.Throw -Version 2.0.1                
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="OwlDomain.Common.Throw" Version="2.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add OwlDomain.Common.Throw --version 2.0.1                
#r "nuget: OwlDomain.Common.Throw, 2.0.1"                
#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 OwlDomain.Common.Throw as a Cake Addin
#addin nuget:?package=OwlDomain.Common.Throw&version=2.0.1

// Install OwlDomain.Common.Throw as a Cake Tool
#tool nuget:?package=OwlDomain.Common.Throw&version=2.0.1                

Common.Throw

A package that provides non-inlinable helper methods for throwing different exceptions, meant to reduce the binary size.

This package is optional and you can always replace it with your own custom throw methods, if you wish to do so check out the OwlDomain.Common.Throw.Base package.

Usage

Using the provided packages is extremely simple, after referencing them from your project simply use the OwlDomain.Common namespace, which will provide you access to the static Throw class, which provides the static property For, on which you will have access to all of the extension methods for throwing exceptions.

An example of this would be

using OwlDomain.Common;

Throw.For.Argument("message", "parameterName");
// Equivalent to
throw new ArgumentException("message", "parameterName");

There will be cases where the compiler complains that you aren't returning a value, when you use the regular throw statements that doesn't happen, however the compiler will still complain when it comes to methods, even if they are marked with the DoesNotReturnAttribute.

For this reason, each of the throw methods also has a generic overload which pretends to return a value of whatever type you wish, you would use it like so:

using OwlDomain.Common;

return Throw.ForArgument<int>("message", "parameterName");

License

This project (the source, and the release files, e.t.c) is release under the OwlDomain License.

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 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 was computed. 
.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.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on OwlDomain.Common.Throw:

Package Downloads
OwlDomain.Common.Throw.Guards

A package that provides guard methods used for throwing exceptions if the required conditions are not met.

OwlDomain.Common

A package that contains various commonly used code.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.1 154 10/2/2024
2.0.0 136 10/2/2024