Releases: skybrud/Skybrud.Essentials
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
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.
v1.1.56
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
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 anIEnumerable<T>
to aList<T>
- eg. via at the end of a method chain. -
Introduced new
ReadOnlyCollection
andReadOnlyList
classes (see d8ab691)
This also introduces the staticReadOnlyCollection.Empty<T>
andReadOnlyList<T>
methods as an alternative toArray.Empty<T>
. -
Introduced
IsDanish
,IsEnglish
andIsGerman
extension methods forCultureInfo
(see 2def2c5)
Allows checking whether aCultureInfo
instance represents either a Danish, English or German language. -
Introduced new
JsonObjectBaseConverter
JSON converter (see 6c2cfc1)
The converter allows converting aJsonObjectBase
instance to a JSON string and from a JSON string to aJsonObjectBase
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
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 thev1.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 ofv1.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 theNET_FRAMEWORK
compile constant is set. While theNameValueCollection
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 theI_CAN_HAS_NAME_VALUE_COLLECTION
compile constant. -
Added
ToTitleCase
extension methods (see fc2f736)
The implementation uses .NET'sTextInfo.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 aNameValueCollection
and also matches similar named extension methods for other collection.
v1.1.53
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 onDateTimeOffset
(see 7887034)
The following properties were added:Date
DateTime
LocalDateTime
UtcDateTime
Microsecond
(.NET 7+)Nanosecond
(.NET 7+)UtcTicks
-
Added
IsSameDay
extension methods forDateTime
andDateTimeOffset
(see e5fed31)
Similar methods already exist as static utility methods, so they might as well be available as extension methods.
v1.1.52
v1.1.51
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 convertingDateTime
,DateTimeOffset
andTimeSpan
instances to their ISO 8601 representation (see 955cc60)
As an alternative to the staticIso8601Utils.ToString
methods, similar functionality is now available as extension methods. -
Added
InvariantFormat
static method andToInvariantString
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
andGetPropertyInfo
methods to theReflectionUtils
class (see f12eb5f)
The methods allows getting either method info or property info of an expression using reflection. -
Added static
Min
andMax
methods for getting the minimum and maximum values of two or moreDateTime
orDateTimeOffset
instances (see 7858f98)
Might be slightly easier to get the minimum or maximum with these methods.
v1.1.50
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 theTryParseJson...
methods should be nullable (see ee2d02b)
No reason not to. If thejson
parameter isnull
, parsing will fail and the methods will returnfalse
. -
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
andTryGetInt32
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 forSystem.String
(see 00679ed)
The newRegeExtensions.RegexReplace
extensions methods allows doing a regex replacements in a method chain opposed to using .NET's staticRegex.Replace
methods.
v1.1.49
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 theFirstWithValue
method overloads supports specifying an array or a collection of string values respectively. The nullable annotations allowed the arrays/collections to benull
, but not the individual values. As if this release, both are now allowed to benull
. -
Added
[NotNullIfNotNull("value")]
attributes to the first out parameter ofStringExtensions.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 ifvalue
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 theSkybrud.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
andJObjectExtensions
classes (see 403145a)
The classes in theSkybrud.Essentials.Json.Extensions
has been marked as obsolete as similar classes are found in theSkybrud.Essentials.Json.Extensions.Newtonsoft
namespace.
v1.1.48
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'sNamingStrategy
class and allows specifying aTextCasing
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 forNewtonsoft.Json
6.0.8 under the basis that the package supported old versions not forcing people to upgradeNewtonsoft.Json
, but also allowed people to use newer versions as they would probably already haveNewtonsoft.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.