OwlDomain.Common 1.2.0

Prefix Reserved
dotnet add package OwlDomain.Common --version 1.2.0
                    
NuGet\Install-Package OwlDomain.Common -Version 1.2.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="OwlDomain.Common" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OwlDomain.Common" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="OwlDomain.Common" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add OwlDomain.Common --version 1.2.0
                    
#r "nuget: OwlDomain.Common, 1.2.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.
#addin nuget:?package=OwlDomain.Common&version=1.2.0
                    
Install OwlDomain.Common as a Cake Addin
#tool nuget:?package=OwlDomain.Common&version=1.2.0
                    
Install OwlDomain.Common as a Cake Tool

OwlDomain.Common

A package that contains commonly used features and extensions.

Usage

The best way (in our opinion), to use this package is by using C#'s global usings for the parts of the package that you want, for example:

global using OwlDomain.Common.Locking;
global using OwlDomain.Common.Exceptions;
global using OwlDomain.Common.Guards;

DisposableBase

The OwlDomain.Common.DisposableBase class is an abstract class that lets you easily follow the disposable pattern.

ObservableBase

The OwlDomain.Common.Observable.ObservableBase class is an abstract class that lets you raise PropertyChanging and PropertyChanged events.

Enum extensions

The OwlDomain.Common.Enums.EnumExtensions class contains several extension methods for working with enums.

Locking extensions

The OwlDomain.Common.Locking namespace contains various types for making thread locking mechanisms easier to use, where instead of doing:

SemaphoreSlim semaphore = ...;

semaphore.Wait();
try
{
	// Code goes here.
}
finally
{
	semaphore.Release();
}

you can instead do:

SemaphoreSlim semaphore = ...;

using (semaphore.Lock())
{
	// Code goes here.
}

The same approach is also available for the System.Threading.ReaderWriterLockSlim class.

Throw helpers

The OwlDomain.Common.Exceptions.Throw class acts as an entry point for throwing new exceptions through the following patterns:

// Throws System.Exception.
Throw.New.Exception("Exception message");

// Throws System.Exception, pretends to return a string value.
return Throw.New.Exception<string>("Exception message");

Argument guards

The OwlDomain.Common.Guards namespace contains extension methods that act as argument guards, and are used in the following way:

static void Foo(int value)
{
	// Throws System.ArgumentOutOfRangeException for the value parameter if it's < 5.
	value.ThrowIfLessThan(5);
}

License

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

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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

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
1.2.0 91 5/17/2025
1.1.1 133 5/7/2025
1.1.0 138 5/7/2025
1.0.0 121 10/4/2024

v1.2.0 [17-05-2025]:
- Enum guards (ThrowIfWithoutFlag).
- String guards (IsEmpty/White-space).
- Updated readme files.

v1.1.1 [07-05-2025]:
- Updated readme files (why do I always forget).
- Added some extra NuGet package tags.

v1.1.0 [07-05-2025]:
- Added release notes.
- Updated the package to match the new OwlDomain style.
- Updated the license to 1.0.2 (wording tweaks).
- Add enum extensions for checking whether an enum value is defined.
- Add throw helpers to replace OwlDomain.Common.Throw.
- Add guard to replace OwlDomain.Common.Throw.Guards.
- Enum guards (IsDefined).
- Null guards (IsNull).
- Comparison guards (LessThan/GreaterThan/IsBetween).