Version 1.1.59

Date 2025-04-22 (5 days ago)
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.59

or the NuGet Package Manager:

Install-Package Skybrud.Essentials -Version 1.1.59

#changelog">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.