Skip to content

Releases: skybrud/Skybrud.Essentials

v1.1.57

21 Apr 10:10
Compare
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
Compare
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.

v1.1.55

05 Feb 22:11
Compare
Choose a tag to compare

Installation

Install via NuGet - either via the .NET CLI:

dotnet add package Skybrud.Essentials --version 1.1.55

or the NuGet Package Manager:

Install-Package Skybrud.Essentials -Version 1.1.55

Changelog

  • Introduced new SelectArray extension method (see e68d941)
    Basically a shorter version of .Select(...).ToArray().

  • Introduced new SelectReadOnlyList extension method (see 744fb20)
    An alternative version of .Select(...).ToArray() or .Select(...).ToList().

  • Introduced new AppendTo extension method (see c6f575c)
    The method allows appending an IEnumerable<T> to a List<T> - eg. via at the end of a method chain.

  • Introduced new ReadOnlyCollection and ReadOnlyList classes (see d8ab691)
    This also introduces the static ReadOnlyCollection.Empty<T> and ReadOnlyList<T> methods as an alternative to Array.Empty<T>.

  • Introduced IsDanish, IsEnglish and IsGerman extension methods for CultureInfo (see 2def2c5)
    Allows checking whether a CultureInfo instance represents either a Danish, English or German language.

  • Introduced new JsonObjectBaseConverter JSON converter (see 6c2cfc1)
    The converter allows converting a JsonObjectBase instance to a JSON string and from a JSON string to a JsonObjectBase instance.

  • Introduced new FirstCharToLower extension method (see d298fdb)
    Replaces the first character of an input string to it's lower case representation.

v1.1.54

13 Dec 22:57
Compare
Choose a tag to compare

Installation

Install via NuGet - either via the .NET CLI:

dotnet add package Skybrud.Essentials --version 1.1.54

or the NuGet Package Manager:

Install-Package Skybrud.Essentials -Version 1.1.54

Changelog

  • Compile constants for .NET 5 and .NET 6 should also apply to .NET 7 and .NET 8 (see #44 and 6fe82aa)
    For the v1.1.53 I added .NET 7 as an additional target framework, but forgot updating the compile constants used throughout the package, so large portions of the package weren't part of v1.1.53 when using the .NET 7 build. This release fixes the compile constants so the missing functionality is now is back.

  • Changed compile constants used in the NameValueCollectionExtensions.cs file and similar files (see 8790b87)
    Prior to this commit, the file content has only been enabled when the NET_FRAMEWORK compile constant is set. While the NameValueCollection class isn't available in all target frameworks, it is available from .NET Standard 2.0 and up as well as .NET 5 and up. To also enabled the file content for these target frameworks, we should instead check against the I_CAN_HAS_NAME_VALUE_COLLECTION compile constant.

  • Added ToTitleCase extension methods (see fc2f736)
    The implementation uses .NET's TextInfo.ToTitleCase method to convert a string to title case.

  • Added additional extension methods for "NameValueCollection" (see a93bfd0 and a68aa06)
    This provides some additional functionality for reading and parsing values from a NameValueCollection and also matches similar named extension methods for other collection.

v1.1.53

03 Nov 16:01
Compare
Choose a tag to compare

Installation

Install via NuGet - either via the .NET CLI:

dotnet add package Skybrud.Essentials --version 1.1.53

or the NuGet package manager:

Install-Package Skybrud.Essentials -Version 1.1.53

Changelog

  • Added .NET 7 as an additional target framework (see 3bc7637)
    This means that the package can start using some of the newer C# features that are specific to .NET 7.

  • Added additional properties to EssentialsTime that exists on DateTimeOffset (see 7887034)
    The following properties were added:

    • Date
    • DateTime
    • LocalDateTime
    • UtcDateTime
    • Microsecond (.NET 7+)
    • Nanosecond (.NET 7+)
    • UtcTicks
  • Added IsSameDay extension methods for DateTime and DateTimeOffset (see e5fed31)
    Similar methods already exist as static utility methods, so they might as well be available as extension methods.

v1.1.52

12 Sep 15:01
Compare
Choose a tag to compare

Installation

Install via NuGet - either via the .NET CLI:

dotnet add package Skybrud.Essentials --version 1.1.52

or the NuGet package manager:

Install-Package Skybrud.Essentials -Version 1.1.52

Changelog

  • Improved the logic for reading from NameValueCollection (see e1c6759)

v1.1.51

11 Sep 10:58
Compare
Choose a tag to compare

Installation

Install via NuGet - either via the .NET CLI:

dotnet add package Skybrud.Essentials --version 1.1.51

or the NuGet package manager:

Install-Package Skybrud.Essentials -Version 1.1.51

Changelog

  • Added .ToIso8601 extension methods for converting DateTime, DateTimeOffset and TimeSpan instances to their ISO 8601 representation (see 955cc60)
    As an alternative to the static Iso8601Utils.ToString methods, similar functionality is now available as extension methods.

  • Added InvariantFormat static method and ToInvariantString extension method (see 54c7218)
    Adds a bit of extra functionality for easily converting an instance to an invariant string. Probably most relevant for numbers and other simple types.

  • Added new GetMethodInfo and GetPropertyInfo methods to the ReflectionUtils class (see f12eb5f)
    The methods allows getting either method info or property info of an expression using reflection.

  • Added static Min and Max methods for getting the minimum and maximum values of two or more DateTime or DateTimeOffset instances (see 7858f98)
    Might be slightly easier to get the minimum or maximum with these methods.

v1.1.50

13 Jul 09:46
Compare
Choose a tag to compare

Installation

Install via NuGet - either via the .NET CLI:

dotnet add package Skybrud.Essentials --version 1.1.50

or the NuGet package manager:

Install-Package Skybrud.Essentials -Version 1.1.50

Changelog

  • The json parameter of the TryParseJson... methods should be nullable (see ee2d02b)
    No reason not to. If the json parameter is null, parsing will fail and the methods will return false.

  • Added misc extension methods for IDictionary<object, object?> (see 9fef978 and 373408f)
    The new extension methods creates an easier way to get type specific values from the dictionary - eg. GetInt32 and TryGetInt32 extension methods for getting a value as an integer.

  • Fixed ArrayUtils.Empty(type) method (see c65912a)
    The method uses reflection to call the generic method overload, but would fail to so. The added unit test confirms the issue as well as that the issue has now been fixed.

  • Added RegexReplace extension methods for System.String (see 00679ed)
    The new RegeExtensions.RegexReplace extensions methods allows doing a regex replacements in a method chain opposed to using .NET's static Regex.Replace methods.

v1.1.49

02 Jun 20:12
Compare
Choose a tag to compare

Installation

Install via NuGet - either via the .NET CLI:

dotnet add package Skybrud.Essentials --version 1.1.49

or the NuGet package manager:

Install-Package Skybrud.Essentials -Version 1.1.49

Changelog

  • Updated nullable annotations for the StringUtils.FirstWithValue methods (see #43 and 7ccd11d)
    Two of the FirstWithValue method overloads supports specifying an array or a collection of string values respectively. The nullable annotations allowed the arrays/collections to be null, but not the individual values. As if this release, both are now allowed to be null.

  • Added [NotNullIfNotNull("value")] attributes to the first out parameter of StringExtensions.Split methods (see 70a0ef9)
    Since splitting a string always results in an array with at least one item, the first out parameter is known to be not null if value is not null.

  • Copied JSON converters to the Newtonsoft namespace (see ede5e46)
    Two differentiate between Newtonsoft.Json and System.Text.Json, the existing JSON converters have been copied to the Skybrud.Essentials.Json.Newtonsoft.Converters namespace. The JSON converters are copied rather than moved since that would be a breaking change. The existing JSON converters are instead marked as obsolete.

  • Added various utility and extension methods for the Assembly class (see 5643962)
    The new methods allow getting various details of an assembly.

  • Marked JArrayExtensions and JObjectExtensions classes (see 403145a)
    The classes in the Skybrud.Essentials.Json.Extensions has been marked as obsolete as similar classes are found in the Skybrud.Essentials.Json.Extensions.Newtonsoft namespace.

v1.1.48

24 Mar 19:55
Compare
Choose a tag to compare

Installation

Install via NuGet - either via the .NET CLI:

dotnet add package Skybrud.Essentials --version 1.1.48

or the NuGet package manager:

Install-Package Skybrud.Essentials -Version 1.1.48

Changelog

  • Improved the logic behind converting between different text casings (see dff82de)
    The implementation is now both faster and better and converting back and forth between different casings. In addition to these improvements, this release also introduces support for header case (Header-Case), snake case (snake_case) and constant case (CONSTANT_CASE).

  • Introduced new TextCasingNamingStrategy class (see 06ac09b)
    The class extends JSON.net's NamingStrategy class and allows specifying a TextCasing to be used for serializing property names.

  • Updated NuGet dependencies (see 751bf70)
    For the lifetime of this package, .NET Framework versions of the package has had a dependency for Newtonsoft.Json 6.0.8 under the basis that the package supported old versions not forcing people to upgrade Newtonsoft.Json, but also allowed people to use newer versions as they would probably already have Newtonsoft.Json installed. A lot of time has passed since then, so now might the time to bump the lower requirement to 9.0.1.

    To provide code analysis for older frameworks, recent versions of this package have also had a dependency for Nullable, but not for all target frameworks. Since the dependency is private, it shouldn't hurt having the dependency for all target frameworks. This also makes the .csproj file a bit more clean.