DotNetXtensions 2.0.0

A general purpose toolbox of helpful .NET functions, extensions methods, and types.

There is a newer version of this package available.
See the version list below for details.
Install-Package DotNetXtensions -Version 2.0.0
dotnet add package DotNetXtensions --version 2.0.0
<PackageReference Include="DotNetXtensions" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DotNetXtensions --version 2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

DotNetXtensions version uped to 2.0.0 for breaking API changes (huge improvements) to XString and XDateTimes

XString breaking changes (2.0.0) ---

Documentation added to:
XString.CharFromEnd,
XString.CutEnd

Documentation reworked:

  • XString.End

API change!:

  1. CutEnd overload that took param string endString renamed as follows:

string CutEnd(this string s, string endString, bool checkDoesEndWith = true, bool ignoreCase = false)

renamed to:

string CutEndIfEndsWith(this string s, string endString, bool checkDoesEndWith = true, bool ignoreCase = false)

  1. CutEnd overload that took param char endChar renamed as follows:

string CutEnd(this string s, char endChar, bool ignoreCase = false)

renamed to:

string CutLastCharIfEndsWith(this string s, char endChar, bool ignoreCase = false)

XDateTimes breaking changes (2.0.0) ---

Numerous 'ParseDateTimeWithOffsetInfo' methods REMOVED, all now consolidated to 3 public members

  • Removed:
    ParseDateTimeLenientDefault
    TryParseDateTimeLenient
    TryParseDateTimeLenientAfterFail
    ParseDateTimeOffsetLenientDefault
    TryParseDateTimeOffsetLenient
    TryParseDateTimeOffsetLenientAfterFail

Many of these were not nearly well-thought out enough to enter the library, forgive me. Suffice to say, we now have 3 very clean and I think very useful functions:

  • Added or completely reworked and tested:
    bool DateTimeStringHasOffset(string dtStr, out TimeSpan offset) (was completely reworked)
    bool HasObsoleteUSTimeZone(ref string dateString, out TimeSpan offset) (largely reworked)
    ParseDateTimeWithOffsetInfo: (massively reworked, very powerful)

    in full:
    (bool success, bool hadOffset, DateTimeOffset result) ParseDateTimeWithOffsetInfo( string dateStr, TimeSpan? localOffset = null, TimeZoneInfo localTimeZone = null, bool treatNoOffsetAsLocalTime = true, bool handleObsoleteUSTimeZones = false)

  • TICKS_AT_EPOCH constant made public

  • Added XDateTimes_DateTimeParsing unit tests for 3 functions

DotNetXtensions version uped to 2.0.0 for breaking API changes (huge improvements) to XString and XDateTimes

XString breaking changes (2.0.0) ---

Documentation added to:
XString.CharFromEnd,
XString.CutEnd

Documentation reworked:

  • XString.End

API change!:

  1. CutEnd overload that took param string endString renamed as follows:

string CutEnd(this string s, string endString, bool checkDoesEndWith = true, bool ignoreCase = false)

renamed to:

string CutEndIfEndsWith(this string s, string endString, bool checkDoesEndWith = true, bool ignoreCase = false)

  1. CutEnd overload that took param char endChar renamed as follows:

string CutEnd(this string s, char endChar, bool ignoreCase = false)

renamed to:

string CutLastCharIfEndsWith(this string s, char endChar, bool ignoreCase = false)

XDateTimes breaking changes (2.0.0) ---

Numerous 'ParseDateTimeWithOffsetInfo' methods REMOVED, all now consolidated to 3 public members

  • Removed:
    ParseDateTimeLenientDefault
    TryParseDateTimeLenient
    TryParseDateTimeLenientAfterFail
    ParseDateTimeOffsetLenientDefault
    TryParseDateTimeOffsetLenient
    TryParseDateTimeOffsetLenientAfterFail

Many of these were not nearly well-thought out enough to enter the library, forgive me. Suffice to say, we now have 3 very clean and I think very useful functions:

  • Added or completely reworked and tested:
    bool DateTimeStringHasOffset(string dtStr, out TimeSpan offset) (was completely reworked)
    bool HasObsoleteUSTimeZone(ref string dateString, out TimeSpan offset) (largely reworked)
    ParseDateTimeWithOffsetInfo: (massively reworked, very powerful)

    in full:
    (bool success, bool hadOffset, DateTimeOffset result) ParseDateTimeWithOffsetInfo( string dateStr, TimeSpan? localOffset = null, TimeZoneInfo localTimeZone = null, bool treatNoOffsetAsLocalTime = true, bool handleObsoleteUSTimeZones = false)

  • TICKS_AT_EPOCH constant made public

  • Added XDateTimes_DateTimeParsing unit tests for 3 functions

Release Notes

DotNetXtensions version uped to 2.0.0 for breaking API changes (huge improvements) to XString and XDateTimes

--- XString breaking changes (2.0.0) ---

Documentation added to:
XString.CharFromEnd,
XString.CutEnd

Documentation reworked:
- XString.End

API change!:

1) `CutEnd` overload that took param `string endString` renamed as follows:

`string CutEnd(this string s, string endString, bool checkDoesEndWith = true, bool ignoreCase = false)`

renamed to:

`string CutEndIfEndsWith(this string s, string endString, bool checkDoesEndWith = true, bool ignoreCase = false)`

2) `CutEnd` overload that took param `char endChar` renamed as follows:

`string CutEnd(this string s, char endChar, bool ignoreCase = false)`

renamed to:

`string CutLastCharIfEndsWith(this string s, char endChar, bool ignoreCase = false)`

--- XDateTimes breaking changes (2.0.0) ---

Numerous 'ParseDateTimeWithOffsetInfo' methods REMOVED, all now consolidated to 3 public members

- Removed:
`ParseDateTimeLenientDefault`
`TryParseDateTimeLenient`
`TryParseDateTimeLenientAfterFail`
`ParseDateTimeOffsetLenientDefault`
`TryParseDateTimeOffsetLenient`
`TryParseDateTimeOffsetLenientAfterFail`

Many of these were not nearly well-thought out enough to enter the library, forgive me. Suffice to say, we now have 3 very clean and I think very useful functions:

- Added or completely reworked and tested:
`bool DateTimeStringHasOffset(string dtStr, out TimeSpan offset)` (was completely reworked)
`bool HasObsoleteUSTimeZone(ref string dateString, out TimeSpan offset)` (largely reworked)
`ParseDateTimeWithOffsetInfo`: (massively reworked, very powerful)

 in full:
 `(bool success, bool hadOffset, DateTimeOffset result) ParseDateTimeWithOffsetInfo(
   string dateStr, TimeSpan? localOffset = null, TimeZoneInfo localTimeZone = null, bool treatNoOffsetAsLocalTime = true, bool handleObsoleteUSTimeZones = false)`

- TICKS_AT_EPOCH constant made public

- Added XDateTimes_DateTimeParsing unit tests for 3 functions

  • .NETStandard 2.0

    • No dependencies.

NuGet packages (10)

Showing the top 5 NuGet packages that depend on DotNetXtensions:

Package Downloads
DotNetXtensions.Common
A number of helpful collections, such as a DropOffStack, a PriorityQueue, some binary-search types that allow chop-searching on virtual collections (not just on an array), and a grab-bag of additional types such as: A ConcurrentTasksRunner, a GuidTimeStamp, a Colour type, and so forth.
DotNetXtensions.MimeTypes
MIME type helper for getting some common ("basic") MIME types, and the ability to know their associated file extensions, or to find a MIME type(s) from an extension, and so forth. This is NOT intended to be exhaustive (as having an exhaustive enum for mimetypes would not be encouraged), but to represent most of the commonly encountered file / MIME types one encounters on the web.
DotNetXtensions.XUnit
Provides minor set of xunit helpers
DotNetXtensions.Cryptography
Some cryptography and compression related helper extension methods and types. Extension methods that make it easy to get SHA hashes as well as AES-256 encryption on strings and byte-arrays. XZip which makes it easy to convert byte arrays and Streams to and from a ZipArchive (a zip file). RandomStringGenerator and RandomNumbers types, a PasswordStrengthEvaluator, and a CryptoRandom type (which inherits Random), which allows semi-crytographically secure random generation, based on RNGCryptoServiceProvider, but which uses a caching system that greatly expediates performance.
DotNetXtensions.Json
Some Newtonsoft.JSON helper extension methods and types (e.g. JsonConverters). Most important is the extension method on objects exposting a useful `ToJson` extension method, which allows one to serialize any object to Json with a single call, while being able to specify whether to indent, to camel-case property names, to serialize enums as strings, and etc. On the other end exposes a DeserializeJson extension method on strings and byte arrays. Nothing earth-shattering here, but helps those cases where you want quick and no-nonsense JSON serialization / deserialization.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
3.9.0 139 5/30/2020
3.8.0 110 5/8/2020
3.7.0 115 12/20/2019
3.6.0 140 9/25/2019
3.5.0 600 8/1/2019
3.5.0-beta1 147 7/23/2019
3.4.0 233 7/11/2019
3.3.1 162 7/5/2019
3.3.0 243 7/1/2019
3.2.0 175 6/30/2019
3.1.0 486 6/18/2019
3.0.1 384 4/30/2019
2.0.0 271 9/18/2018
1.0.1 299 9/13/2018
1.0.0 282 9/12/2018
Show less