Date | 2022-08-27 (811 days ago) |
---|---|
Downloads | 37K downloads |
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 |
#installation
">InstallationInstall the NuGet package - either via the .NET CLI:
dotnet add package Skybrud.Essentials --version 1.1.42
or the NuGet package manager:
Install-Package Skybrud.Essentials -Version 1.1.42
#changelog
">ChangelogIntroduced StringUtils.FormatFileSize
methods for formatting file size (see #29
, 1b15443
and f6acd89
)
Depending on the input, file sixes may be formatted using either kilobytes, kibibytes, or a mix of the two.
Added missing this
keyword to ToHexString
extension method (see 50f616a
)
The method doesn't really work as an extension method without the keyword.
Added TryParse{Type}
method overloads support a nullable result (see #30
, 003a1f8
)
Added IsBoolean
method overloads to the StringExtensions
class (see #30
and 4239551
)
The first method overload takes a string as it's only parameter, and returns whether the string value can be parsed and converted into a bool equivalent.
The second method overload does the same, but has an additional parameter that uses the "out" keyword to expose the "bool?" value that resulted from the conversion.
Added new TryParseInt32
methods to the StringUtils
class + unit tests (see #30
and 1caee9f
)
The new methods provides a culture invariant way to try/parsing integers.
Introduced new StringUtils.Parse{Type}List
methods and StringUtils.To{Type}List
extension methods (see #38
and fc9476d
)
This also changes the implementation of the "StringUtils.ParseArray" methods as they should never have used regular expressions for validating the individual number values.
Added new TryParse{Type}
methods where necessary (see #30
and 589f87c
)
The new methods provides a culture invariant way to try/parsing various simple types.
Added Is{Type}
method overloads to the StringExtensions
class (see #30
and fd0b70a
)
The methods include IsBoolean
, IsInt32
, IsInt64
and similar to quickly test whether an input string matches a given simple type.
IsBetween
methods to the EnumUtils
and EnumExtensions
classes (see #31
and 09556ec
)Updated XmlUtils.ToString
method to set correct encoding in the generated XML declaration (see #37
and 7eab851
)
This ensures that the XML declaration is part of the generated XML string when using the XmlUtils.ToString(XDocument)
method - opposed to the default XDocument.ToString
method where the XML declaration is omitted.
Added new XmlUtils.ToString
method overload (see #37
and b4b10e1
)
The new overload takes a second parameter of the type SaveOptions
, thereby controlling the format of the generated XML string.
Implemented new ArrayUtils.Empty<T>
utility method (see #40
and eb2b19b
)
As this package targets multiple frameworks, we can't really use Array.Empty<T>
in all of them, so the ArrayUtils.Empty<T>
provides a way to accomplish the same across all target frameworks.
Introduced new RandomOrDefault
and OrderByRandom
methods (see #39
and 49fa772
)
This adds methods for getting a random item of an IEnumerable<T>
as well as sorting a IEnumerable<T>
.
Added GetVersion
, GetFileVersion
, GetInformationalVersion
and GetFileVersionInfo
method overloads (see 5074590
)
The new overloads take a Type
instance as a single parameter, thereby supporting a few extra scenarios where using Type
makes sense.
Added new IsExtensionClass
and IsExtensionMethod
methods to the ReflectionUtils
and ReflectionExtensions
classes (see 7fe6134
)
The methods may be used to check whether a class is an extension class or a method is an extension method.