v1.1.57
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
ToInvariantStringextension method overloads (211e954)
Classes implementing theIFormattableinterface indicates that they can be converted to a string representation using a specified format. The first overload therefore takes an instance ofIFormattableand a second parameter for the format.From .NET 7 and up, .NET features the
StringSyntaxAttributeclass, that can be used to specify the available format for the "format" parameter, which then can improve the intellisense. Additional extension method overloads forDateTime,DateTimeOffsetandTimeSpanare added as well.The extension method overloads are added for all of the current target frameworks. Since
StringSyntaxAttributeis only supported from .NET 7 and up, Skybrud.Essentials adds an internalStringSyntaxAttributeclass to also support older target frameworks. This should then - in theory - also allow better intellisense for those target frameworks. -
Updated the
EssentialsDateandEssentialsTimeclasses to implement theIFormattableinterface (see 65ae719)
By implementing theIFormattableinterface a format may now be specified when using theEssentialsDateandEssentialsTimeclasses in string interpolation. -
Added
StringSyntaxAttributeto variousformatparameters (see 2cd19a5)
This may help IDEs give a better developer experience by indicating the format to be used. -
Added
Splitextension method overloads (see 20eafee)
The package already contains a number ofSplitextension methods. With this release, a number of additional overloads have been added with additonal parameters. -
Introduced new
ReadOnlySetclass andReadOnlySet.Empty<T>static method (see fc0614e)
Similar to theEnumerable.Empty<T>andArray.Emptymethod in .NET, Skybrud.Essentials now offers a method to get an empty immutable instance ofIReadOnlySet. As theIReadOnlySetinterface 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.IsMatchextension method overloads (see a5c5148)
The new overloads support additional scenarios - e.g. with more out parameters. -
Introduced new static
ParseStringListandParseStringReadOnlyListmethods (fbccb0d)
Supports a few additional scenarios - in additional to the existingParseStringArraymethod. -
EssentialsDate.ToStringmethods 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.ToStringandEssentialsTime.ToStringmethods (see 85316d9)
Normally when an object is used in string interpolation, the object's parameterlessToStringmethod is called for getting a string representation of the object. But if the object implements theIFormattableinterface - as bothEssentialsDateandEssentialsTimedo now - theToString(string? format, IFormatProvider? provider)method will be called instead, but with theformatparameter 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
ToEssentialsDateandToEssentialsTimeextension methods for bothDateTimeandDateTimeOffset(d556dc9)
The extension methods offer the same functionality as theEssentialsDateandEssentialsTimeconstructors, but may be used in a method chain which is not possible with a constructor.