Skip to content

Releases: skybrud/Skybrud.Essentials

v1.1.64

22 Feb 18:00

Choose a tag to compare

Installation

Install via NuGet - either via the .NET CLI:

dotnet add package Skybrud.Essentials --version 1.1.64

or the NuGet Package Manager:

Install-Package Skybrud.Essentials -Version 1.1.64

Changelog

  • Added Then extension methods for use in async method chains (see 389deeb)

  • Added ToStringList extension methods for string (see 678ce14)

v1.1.63

27 Nov 14:55

Choose a tag to compare

Installation

Install via NuGet - either via the .NET CLI:

dotnet add package Skybrud.Essentials --version 1.1.63

or the NuGet Package Manager:

Install-Package Skybrud.Essentials -Version 1.1.63

Changelog

  • Added misc utility and extension methods for converting string values into corresponding HashSet<> values (see 22cbf8b)
    Similar to the existing StringUtils.Parse{Type}Array and StringUtils.Parse{Type}List, similar StringUtils.Parse{Type}Set methods are now available with this release.

  • Added .NET 8 and .NET 10 as additional target frameworks (see 22da437)
    These are LTS releases of .NET and as such should be the primary target frameworks for this package. Ideally all EOL target frameworks should be removed, but as this would be a breaking change, this will be addressed in a v1.2.0 or 2.0.0 release instead.

v1.1.62

03 Nov 10:06

Choose a tag to compare

Installation

Install via NuGet - either via the .NET CLI:

dotnet add package Skybrud.Essentials --version 1.1.62

or the NuGet Package Manager:

Install-Package Skybrud.Essentials -Version 1.1.62

Changelog

  • Fixed issue with EssentialsTime.FromTicks (see 109a493)
    Two of the method overloads would internally parse the ticks into a DateTime instance, but not specify a Kind, in which case this falls back to Unspecified, thereby creating a lot of uncertainty when converting back and forth between time zones. With this commit, the two method overloads will instead use parse the ticks into a DateTimeOffset relative to UTC, and then convert to the time zone specified by the user.

v1.1.61

16 Oct 12:37

Choose a tag to compare

Installation

Install via NuGet - either via the .NET CLI:

dotnet add package Skybrud.Essentials --version 1.1.61

or the NuGet Package Manager:

Install-Package Skybrud.Essentials -Version 1.1.61

Changelog

  • Fixed issue with ToInvariantString extension methods (see a01b5f1)
    For the overloading taking an IFormattable, we shouldn't use string.Format as the format is directly for the IFormattable.

  • Fixed misc issues when getting values from JArray (see 63c9245)
    The idea behind these methods is that they should to call, meaning if you call GetInt32(0) and the item isn't found, or the value cannot be converted to a 32-bit integer, the method should return a default value instead of throwing an exception. As this wasn't the case, the implementation has been updated to reflect this.

    • added check for min and max values
    • no longer tries to cast values
    • added additional GetType and TryGetType extension methods
    • added lots of unit tests
    • etc.

v1.2.0-alpha001

08 Jul 19:30

Choose a tag to compare

v1.2.0-alpha001 Pre-release
Pre-release

Installation

Install via NuGet - either via the .NET CLI:

dotnet add package Skybrud.Essentials --version 1.2.0-alpha001

or the NuGet Package Manager:

Install-Package Skybrud.Essentials -Version 1.2.0-alpha001

v1.1.60

10 Jun 10:12

Choose a tag to compare

Installation

Install via NuGet - either via the .NET CLI:

dotnet add package Skybrud.Essentials --version 1.1.60

or the NuGet Package Manager:

Install-Package Skybrud.Essentials -Version 1.1.60

Changelog

  • Added new GetNativeLanguageName extension method for CultureInfo (see 8577b69)
    A CultureInfo may be based on a language or a language in a specific country. For the latter, the native name will be something like "Dansk (Danmark)", but when based on both a language and a country, the CultureInfo will have a reference to parent CultureInfo that will only be based on the language, so the native name for this will be "Dansk" instead, which is exactly what we want for this method.

  • Added Extends and Implements method overloads (see 9a570f2)
    Abstract or static classes can't be used as a generic type parameter, so the new method overloads take a Type instance instead.

  • Added logic for getting the build date from an assembly (see aa01744)
    This is mainly an internal thing.

  • Added misc extension methods for parsing IConfiguration values (see b955d44)
    This makes manual parsing of IConfiguration instances a bit easier.

  • Added ParseJsonObject and LoadJsonObject method overloads to the JsonUtils class (see 43dca9a)
    The new method overloads allow specifying a Type parameter instead of a generic type parameter.

  • Introduced new StreamUtils class (c19a61f)
    The class contains various utility/helper methods from converting to a stream and back again.

  • Introduced new JsonUtils.LoadJsonToken, JsonUtils.LoadJsonObject, and JsonUtils.LoadJsonArray method overloads (see 7b7434f)
    The existing methods supports loading JSON values from a path the disk, whereas the new methods allow loading JSON values from a stream.

  • Fixed issue with the "EssentialsWeek.GetStartOfWeek" method returning an incorrect in edge cases (see 5c30341)
    Time calculations with time zones and daylight savings can be a bit tricky. The EssentialsWeek.GetStartOfWeek method would in some cases return an incorrect result by not properly accounting for days daylight savings starts or ends.

v1.1.59

22 Apr 18:04

Choose a tag to compare

Installation

Install via NuGet - either via the .NET CLI:

dotnet add package Skybrud.Essentials --version 1.1.59

or the NuGet Package Manager:

Install-Package Skybrud.Essentials -Version 1.1.59

Changelog

  • Added [Obsolete] attribute to various extension methods (see 1b234a0)
    The JArrayExtensions, JObjectExtensions and LocationsExtensions classes have been marked as obsolete for a while, but their methods aren't flagged as obsolete when used as extension methods. This release therefore adds [Obsolete] attributes to the individual extension methods similar to those already found on the classes in which they are declared.

  • Fixed misc issues with IXmlNamespaceResolver parameters not being passed on to underlying method calls (see b2133b6)
    For some of the methods in the XPathExtensions class that takes a parameter with an instance of IXmlNamespaceResolver, the parameter wasn't passed on to the underlying method calls, thereby having no effect.

  • Fixed misc issues with HexFormat parameters not being passed on to underlying method calls (see f15813b)
    The SecurityUtils has a number of GetSha256Hash methods, where two of them takes a HexFormat parameter, which wasn't passed on to the underlying method calls.

  • Added WhereList, WhereArray and WhereReadonlyList extension methods for IEnumerable<T> (see 76d8a33)
    These should only be used when converting to a list or array is required.

  • Updated the EnumUtils.TryParseEnum methods to not throw exceptions (see #54 and b820070)
    The general idea with TryParseX methods is that they should fail silently, and then return a boolean value to indicate whether the input value could be parsed. For the TryParseEnum, they would in some cases throw an exception - e.g. if the input string was null. With this commit, they will return false instead and thus fail silently.

  • Better exception handling for EnumUtils.Parse method (see 0e2648f)
    In previous releases, the method would throw an ArgumentNullException regardless of the input string being null or just empty/white space. As of this commit, the method will instead throw the lesser ArgumentException. This matches .NET's behavior, and it also ensures that the exception message matches the actual issue.

  • Added SaveJsonToken to the JsonUtils class (see 4c01d73)
    The class already have SaveJsonObject and SaveJsonArray methods ... and now also SaveJsonToken.

  • Updated the EnumUtils.TryParseEnum to support some edge cases (see 8de688d)
    The implementation would convert the input string to camel case, and then lower case for having a common value for comparing against known values of the target enum type. While the .NET convention is to name these using upper camel case, we should still support when the convention isn't followed (e.g. for some abbreviation and/or numbers, it makes sense to use an underscore). As of this commit, the enum value names are now converted to camel case before any comparisons, thus improving the chances that the parsing is successful.

v1.1.58

18 Feb 15:12

Choose a tag to compare

Installation

Install via NuGet - either via the .NET CLI:

dotnet add package Skybrud.Essentials --version 1.1.58

or the NuGet Package Manager:

Install-Package Skybrud.Essentials -Version 1.1.58

Changelog

  • Added missing [NotNullWhen(true)] attribute to one of the IsObsolete method overloads (see 34643c8)
    This should make the code analysis happy again.

  • Implemented Extends and Implements extension methods for the Type class (see #49 and c302d28)

  • The two new methods introduces a more "friendly" way to determine whether a type extends or implements another class or interface interface.

  • Made JsonTokenUtils methods public (see #48 and aa3c562)
    The JsonTokenUtils class has been used internally in the package for a while for converting JToken instances into something else. Until now the methods have been internal, but since they have a broader usage than just within the package, they are now public instead.

  • Added extension methods for the Regex class (see #47 and a7e921e)
    Similar to the RegexUtils.IsMatch methods already in the package, IsMatch extension methods are now available for Regex instances.

  • Introduced new GetRequired{Type} extension methods for JObject (see 16a0706)
    This release introduces an alternative to the existing Get{Type} extension methods. While the existing GetString, GetInt32 and similar methods already in the package are designed to somewhat failed silent if the underlying property doesn't exist or the value type doesn't match, the GetRequiredString, GetRequiredInt32 and similar methods will throw an exception if a required value isn't found.

  • Added new Get{Type}Value and GetRequired{Type}Value extension methods for XElement (see b906fb6)
    These methods are intended to replace the existing GetAttributeValue and GetElementValue methods, since the new methods have better naming and also proper support for nullable (reference) types.

v1.1.57

21 Apr 10:10

Choose a tag to compare

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 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.

v1.1.56

06 Feb 08:27

Choose a tag to compare

Installation

Install via NuGet - either via the .NET CLI:

dotnet add package Skybrud.Essentials --version 1.1.56

or the NuGet Package Manager:

Install-Package Skybrud.Essentials -Version 1.1.56

Changelog

  • The JsonObjectBaseConverter class shouldn't be internal (see 58c34a7)
    Class was copied from a client project, and I didn't notice the class was internal. It should be public in order for it to be used outside of the package.