Dangl.Common
This library contains common, shared functionality.
Link to documentation
Changelog
CI Builds
CI builds are available via MyGet
https://www.myget.org/F/dangl/api/v3/index.json
Compatibility
This project targets netstandard2.0
, netstandard1.3
and net45
. Due to .Net 4.5.2 being the currently latest supported version
by Microsoft and the xUnit test suite, no tests are run for net45
and net451
.
Classes
BindableBase
Base class for property binding with INotifyPropertyChanged.
ObjectExtensions
The ObjectExtensions.DeepClone()
method may be used to create copies or clones of objects that are value but not reference equal.
StringEncryptionExtensions
Encryption and decryption methods using AES and PBKDF2.
StringExtensions
Sanitize()
method to normalize line endings to current environments default and to also trim whitespaces at each line endToBase64()
andFromBase64()
methodsCompress()
/Decompress
methods using GZip and returning Base64 outputWithMaxLength(int maxLength)
to limit the length of a string by dropping everything above a max lengthWithoutLinebreaks
to remove all linebreaks in a stringWithoutUnprintableCharacters
to remove unprintable characters
StringHashExtensions
Extensions to produce MD5 and SHA256 values for strings.
DecimalExtensions
WithMaxAbsoluteValue(int maxValueAbsolute)
to limit a decimal to a maximum value. This works for both negative and positive decimals, e.g.-3m.WithMaxAbsoluteValue(2)
returns-2
TrulyObservableCollection
Collection that notifies of item changes (add, delete) as well as whenever a child item that implements INotifyPropertyChanged is changed.
ObservableDictionary<TKey, TValue>
This is internally using a Dictionary<TKey, TValue> and raises events when elements are changed.
Supported Frameworks
The library supports netstandard1.3
, netstandard2.0
as well as net45
and net40
. Binaries for the full framework are separately generated for older build tools that do not properly integrate with .NET Standard.
The .NET 4.0 target is for compatibility reasons, it is not tested and requires .NET compilers for version 4.5 or newer to properly function.
If supported by the tooling (Visual Studio 2017 or the dotnet CLI should be fine), it's advised to use the netstandard1.3
target.
When using .NET Standard, all features should be available on Windows, Linux and Mac OS, but unit and integration tests are only performed for the following frameworks on Windows:
net6.0
net5.0
netcoreapp3.1
net461
net46
net47
net452
And on these frameworks in Linux:
net6.0
There are no known issues with other configurations, but neither is their functionality tested.
Assembly Strong Naming & Usage in Signed Applications
This module produces strong named assemblies when compiled. When consumers of this package require strongly named assemblies, for example when they
themselves are signed, the outputs should work as-is.
The key file to create the strong name is adjacent to the csproj
file in the root of the source project. Please note that this does not increase
security or provide tamper-proof binaries, as the key is available in the source code per
Microsoft guidelines