Version 1.1.57

Date 2024-04-21 (208 days ago)
Downloads 8,364 downloads
NuGet View on NuGet
GitHub View on GitHub
Target Frameworks .NET Standard 1.1 .NET Standard 1.3 .NET Standard 2.0 .NET 4.5 .NET 4.6 .NET 4.7 .NET 4.8 .NET 5 .NET 6 .NET 7

#installation">Installation

Install via NuGet - either via the .NET CLI:

dotnet add package Skybrud.Essentials --version 1.1.57

or the NuGet Package Manager:

Install-Package Skybrud.Essentials -Version 1.1.57

#changelog">Changelog

  • Added ToInvariantString extension method overloads (211e954)
    Classes implementing the IFormattable interface indicates that they can be converted to a string representation using a specified format. The first overload therefore takes an instance of IFormattable and a second parameter for the format.

    From .NET 7 and up, .NET features the StringSyntaxAttribute class, that can be used to specify the available format for the "format" parameter, which then can improve the intellisense. Additional extension method overloads for DateTime, DateTimeOffset and TimeSpan are added as well.

    The extension method overloads are added for all of the current target frameworks. Since StringSyntaxAttribute is only supported from .NET 7 and up, Skybrud.Essentials adds an internal StringSyntaxAttribute class to also support older target frameworks. This should then - in theory - also allow better intellisense for those target frameworks.

  • Updated the EssentialsDate and EssentialsTime classes to implement the IFormattable interface (see 65ae719)
    By implementing the IFormattable interface a format may now be specified when using the EssentialsDate and EssentialsTime classes in string interpolation.

  • Added StringSyntaxAttribute to various format parameters (see 2cd19a5)
    This may help IDEs give a better developer experience by indicating the format to be used.

  • Added Split extension method overloads (see 20eafee)
    The package already contains a number of Split extension methods. With this release, a number of additional overloads have been added with additonal parameters.

  • Introduced new ReadOnlySet class and ReadOnlySet.Empty<T> static method (see fc0614e)
    Similar to the Enumerable.Empty<T> and Array.Empty method in .NET, Skybrud.Essentials now offers a method to get an empty immutable instance of IReadOnlySet. As the IReadOnlySet interface is only supported from .NET 5 and up, the new class and method is also only available for .NET 5 and up, but not .NET Framework and .NET Standard.

  • Added additional RegexUtils.IsMatch extension method overloads (see a5c5148)
    The new overloads support additional scenarios - e.g. with more out parameters.

  • Introduced new static ParseStringList and ParseStringReadOnlyList methods (fbccb0d)
    Supports a few additional scenarios - in additional to the existing ParseStringArray method.

  • EssentialsDate.ToString methods should be culture invariant when no culture is specified (see 782e932)
    This has always been my intention, b

  • Added fallback format when no formatting is specified for the EssentialsDate.ToString and EssentialsTime.ToString methods (see 85316d9)
    Normally when an object is used in string interpolation, the object's parameterless ToString method is called for getting a string representation of the object. But if the object implements the IFormattable interface - as both EssentialsDate and EssentialsTime do now - the ToString(string? format, IFormatProvider? provider) method will be called instead, but with the format parameter being null. In order to not introduce any breaking changes, the EssentialsDate.ToString(string? format, IFormatProvider? provider) and EssentialsTime.ToString(string? format, IFormatProvider? provider) methods have now been updated to return the same value as the parameterless EssentialsDate.ToString() and EssentialsTime.ToString() methods, which are an ISO 8601 formatted date and timestamp respectively.

  • Added ToEssentialsDate and ToEssentialsTime extension methods for both DateTime and DateTimeOffset (d556dc9)
    The extension methods offer the same functionality as the EssentialsDate and EssentialsTime constructors, but may be used in a method chain which is not possible with a constructor.