StringExceptions 1.1.0

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

// Install StringExceptions as a Cake Tool
#tool nuget:?package=StringExceptions&version=1.1.0                

StringExceptions

Simplifies the string checks for common cases as null, empty or whitespaces, throwing custom exceptions on those cases.

Inspired on the recent new way in .NET 6 of checking argument null exceptions, this will check for null, empty string and white spaces string and throw it corresponding exception.

Installation

Via NuGet

Install-Package StringExceptions -Version 1.1.0

Usage

using StringExceptions;

StringExceptionsChecker.ThrowIfFails(myString);
// or
StringExceptionsChecker.ThrowIfFails(myString, nameof(myString));

Exceptions

Three exception classes are declared:

  • StringEmptyException: Throws when string is empty.
  • StringNullException: Throws when string is null. (Inherited from ArgumentNullException).
  • StringWhiteSpaceException: Throws when string is ony formed by whitespaces.
Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.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
1.1.0 840 1/28/2022
1.0.1 415 1/23/2022
1.0.0 448 1/23/2022

Rename method to something for meaningful for the developer.