DevextremeToys 8.0.0

dotnet add package DevextremeToys --version 8.0.0                
NuGet\Install-Package DevextremeToys -Version 8.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DevextremeToys" Version="8.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DevextremeToys --version 8.0.0                
#r "nuget: DevextremeToys, 8.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DevextremeToys as a Cake Addin
#addin nuget:?package=DevextremeToys&version=8.0.0

// Install DevextremeToys as a Cake Tool
#tool nuget:?package=DevextremeToys&version=8.0.0                

DevextremeToys

Build Status

Build Status Current Version
CI .NET N/A
Packages nuget-publish-tag NuGet
Packages NUGET-PUBLISH-RELEASE NuGet

How to install

Follow instructions on Nuget.

About Extreme Developer's Toys

In dotnet framework there aren't some useful features. These features are essential and every time we start a new project we need them so we look for them or rewrite them. In this package there are some useful feature for every great developer.

  • ConcurrentList
    • like List<T> but thread safe.
  • String Comparer Extensions
    • With this extension you can use every string comparison but configured in the same way of your database.
  • String Extensions
    • It adds some feature like ReplaceFirst or ReplaceLast.
  • URL base 64 encode & decode
    • String extension to encode string to valid url encoded 64 and viceversa.
  • Reflection Extensions
    • It adds features to all object like SetPropertyValue and GetPropertyValue.
  • Json Extensions
    • It adds features to all objects like .ToJson() and .ToObject() for the string type.
  • Compression Extension
    • It adds features to all object to zip an instance of object.
  • Serializer Extensions
    • It adds features to all object to serialize them to and from byte[]
  • Cryptography Extensions
    • It adds feature to encrypt and decrypt strings
  • List<> or IEnumerable<> Extensions
    • It adds feature to List and IEnumerable such 'Split'
  • Visitor Extensions
    • It adds visitor (graph explorer\object tree explorer) to traverse object graph\aggregate

How to use

The first step is to install this package from Nuget.

Examples

Comcurrent List

Add this using

using DevExtremeToys.Concurrent;

Now you can use ConcurrentList in a multi threading environment

ConcurrentList<int> list = new ConcurrentList<int>();
list.Add(i);

ConcurrentList<MyClass> list = new ConcurrentList<MyClass>();
list.Add(new MyClass() { Name = "Test"});

String Comparer Extension

With this extension you can compare string with Case Sensitive and Accent Sensitive options.

Add this using

using DevExtremeToys.StringComparer;

Now you can compare strings with database rules

You can configure comparer rule once or use different configuration for every comparison.

In this example we use a global configuration

CompareSettings.Instance.GetSetting = () =>
{
    return new Settings()
    {
        CaseOption = CaseOptions.Insensitive,
        AccentOption = AccentOptions.Sensitive
    };
};

string s1 = "à1abbbcccaaabbbccc";
string s2 = "à1ABBBCCCAAABBBCCC";

Assert.True(s1.CompareToDevEx(s1) == 0);

In this example we use a specific configuration

var localSettings = new Settings()
{
    CaseOption = CaseOptions.Sensitive,
    AccentOption = AccentOptions.Sensitive
};
Assert.False(s1.CompareToDevEx(s2, localSettings) == 0);

String Extensions

Add this using

using DevExtremeToys.Strings;

Now your strings have new features like ReplaceLast, ReplaceFirst

string s1 = "a1abbbcccaaabbbccc";
var r = s1.ReplaceLast("bbb", "ZZZ");

URL base 64 encode & decode

Add this using

using DevExtremeToys.Url;

Now your strings have EncodeURL64 and DecodeURL64 methods

string sourceString = "Dinanzi a me non fuor cose create \r\nse non etterne, e io etterno duro. \r\nLasciate ogne speranza, voi ch’intrate";
var encoded = sourceString.EncodeURL64();
var decoded = encoded.DecodeURL64();

Reflection Extensions

Add this using

using DevExtremeToys.Reflection;

Now all objects have new features like:

  • GetPropertyValue
  • SetPropertyValue
  • GetFieldValue
  • SetFieldValue
  • GetPropertyAttribute
  • GetFiledAttribute
MyClass myClass = new MyClas();
myClass.SetPropertyValue(nameof(MyClas.Name), "My Name");

Json Extensions

Add this using

using DevExtremeToys.JSon;

Now all objects have .ToJson() method and strings have .ToObject<>() method

TestClass myClass = new TestClass()
{
    Name = "My Name",
    Description = "My Description",
    Id = 10
};
var json = myClass.ToJSon();
TestClass deserialized = json.ToObject<TestClass>();

Compression Extensions

Add this using

using DevExtremeToys.Compression;

Now all objects have .Zip() method and byte[] has .Unzip<>() method

MyClass myClass = new MyClass()
{
    Name = "My Name",
    Description = "My Description",
    Id = 10
};
var zip = myClass.Zip();
MyClass unZipped = zip.Unzip<MyClass>();

Serializer Extensions

Add this using

using DevExtremeToys.Serialization;

Now all objects have .Zip() method and byte[] has .Unzip<>() method

MyClass myClass = new MyClass()
{
    Name = "My Name",
    Description = "My Description",
    Id = 10
};
var tmp = myClass.ToUTF8ByteArray();
MyClass deserialized = tmp.FromUF8ByteArray<MyClass>();

Cryptography Extensions

Add this using

using DevExtremeToys.Strings;

Now all strings have .AesEncrypt method and .AesDecrypt methods

string key = "12345678901234567890123456789012";
string iv = "1234567890123456";
string plainText = "abcdefghijklmnopqrstuvwxyz1234567890";
string encrypted = plainText.AesEncrypt(key, iv);
string decrypted = encrypted.AesDecrypt(key, iv);

List<> or IEnumerable<> Extensions

Add this using

using DevExtremeToys.List;

Now all List<> or IEnumerable<> have .Split method

IEnumerable<int> list = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
var subLists = list.Split(3);

List<int> list = new List<int>();
//...
var items = list.Split(3);

Visitor Extensions

Add this using

using DevExtremeToys.Visitors;

Now all objects .Visit method

MyClassA a = new MyClassA();
//...
//fill object properties (collection, objects, internals...)
//...
a.Visit((nodeInfo) =>
{
    //nodeInfo.CurrentPath
    //nodeInfo.CurrentPropertyInfo
    //nodeInfo.CurrentInstance
    //nodeInfo.ParentInstance
    //nodeInfo.ParentNode
    //nodeInfo.PropertyName
    Debug.WriteLine(nodeInfo.CurrentPath);
});

... New features are coming soon ...

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
8.0.0 488 12/9/2023
2.0.0 343 4/7/2023
1.4.0 508 7/21/2022
1.4.0-beta 181 7/9/2022
1.3.0 449 7/9/2022
1.2.0 403 6/4/2022
1.1.0 422 5/28/2022
1.0.1 396 5/26/2022
1.0.0 396 5/22/2022
0.0.3-beta 168 5/21/2022
0.0.3-alfa 190 5/21/2022

- (new) .net 8 support
 - (new) url friendly string base 64 encode and decode
 - .net 7 support
 - Added .Pad Extension to string type
 - Fix AmbiguousMatchException in ReflectionExtensions
 - Visitor Extension now has stop visiting feature
 - added Async Visitor Extension
 - Concurrent Generic List (thread safe)
 - Object to JSon and viceversa
 - Object to zip and viceversa
 - String comparison with case sense like database
 - Reflection utilities
 - List utilities
 - Cryptography utilities
 - Visitor Extension
 - And more...
 - See documentation and examples at: https://github.com/AndreaPic/DevextremeToys