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
-
Added
ToInvariantString
extension method overloads (211e954)
Classes implementing theIFormattable
interface indicates that they can be converted to a string representation using a specified format. The first overload therefore takes an instance ofIFormattable
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 forDateTime
,DateTimeOffset
andTimeSpan
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 internalStringSyntaxAttribute
class to also support older target frameworks. This should then - in theory - also allow better intellisense for those target frameworks. -
Updated the
EssentialsDate
andEssentialsTime
classes to implement theIFormattable
interface (see 65ae719)
By implementing theIFormattable
interface a format may now be specified when using theEssentialsDate
andEssentialsTime
classes in string interpolation. -
Added
StringSyntaxAttribute
to variousformat
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 ofSplit
extension methods. With this release, a number of additional overloads have been added with additonal parameters. -
Introduced new
ReadOnlySet
class andReadOnlySet.Empty<T>
static method (see fc0614e)
Similar to theEnumerable.Empty<T>
andArray.Empty
method in .NET, Skybrud.Essentials now offers a method to get an empty immutable instance ofIReadOnlySet
. As theIReadOnlySet
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
andParseStringReadOnlyList
methods (fbccb0d)
Supports a few additional scenarios - in additional to the existingParseStringArray
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
andEssentialsTime.ToString
methods (see 85316d9)
Normally when an object is used in string interpolation, the object's parameterlessToString
method is called for getting a string representation of the object. But if the object implements theIFormattable
interface - as bothEssentialsDate
andEssentialsTime
do now - theToString(string? format, IFormatProvider? provider)
method will be called instead, but with theformat
parameter being null. In order to not introduce any breaking changes, theEssentialsDate.ToString(string? format, IFormatProvider? provider)
andEssentialsTime.ToString(string? format, IFormatProvider? provider)
methods have now been updated to return the same value as the parameterlessEssentialsDate.ToString()
andEssentialsTime.ToString()
methods, which are an ISO 8601 formatted date and timestamp respectively. -
Added
ToEssentialsDate
andToEssentialsTime
extension methods for bothDateTime
andDateTimeOffset
(d556dc9)
The extension methods offer the same functionality as theEssentialsDate
andEssentialsTime
constructors, but may be used in a method chain which is not possible with a constructor.