wan24-Core 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package wan24-Core --version 1.0.1
NuGet\Install-Package wan24-Core -Version 1.0.1
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="wan24-Core" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add wan24-Core --version 1.0.1
#r "nuget: wan24-Core, 1.0.1"
#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 wan24-Core as a Cake Addin
#addin nuget:?package=wan24-Core&version=1.0.1

// Install wan24-Core as a Cake Tool
#tool nuget:?package=wan24-Core&version=1.0.1

wan24-Core

This core library contains some .NET extensions:

  • Disposable base class for disposable types, which supports asynchronous disposing
  • Type helpr (type loading)
  • Secure byte array, which clears its contents when disposing
  • Pool rented array as disposable object
  • Byte array extensions
    • Endian conversion
  • Array helper extensions
    • Offset/length validation
  • Reflection extensions
    • Automatic parameter extension when invoking a method (with DI support)
    • Synchronous/asynchronous method invokation
    • Automatic constructor invokation using a given parameter set (with DI support)
    • Nullability detection
  • Delegate extensions
    • Delegate list invokation (with or without return values, with DI support)
    • Asynchronous delegate list invokation (with or without return values, with DI support)
  • Task extensions
    • Result getting of a generic task
    • Asynchronous task list awaiting
    • Shortcuts for await configurations
  • DI helper
    • Service provider adoption
    • DI object factory delegates
    • Asynchronous DI object factory delegates
  • Enumeration extensions
    • Get enumeration value display string from DisplayTextAttribute or using ToString (fallback)
    • Remove flags of a mixed enumeration value
    • Get only flags of a mixed enumeration value
  • Number extensions
    • Determine if a type is a number
    • Determine if a number type is unsigned

Type helper

You'll have to register searchable assemblies using the TypeHelper.AddAssemblies method. If you use the TypeHelper.AddTypes method, the unknown assemblies of the added types will be added as searchable assemblies automatic.

You may attach to the TypeHelper.OnLoadType event for handling requests more dynamic.

The TypeHelper.GetType method will try Type.GetType first and fall back to the helper, if no type was found.

DI helper

In order to make DI (dependency injection) working, you need to

  • set a DiHelper.ServiceProvider and/or
  • add DiHelper.(Async)ObjectFactories

The DiHelper.GetDiObjectAsync method will try to resolve the request synchronous, first. But the DiHelper.GetDiObject won't try asynchronous object factories.

Mixed enumeration value

A mixed enumeration contains X bits enumeration values, and Y bits flags:

public enum MixedEnum : int
{
    None = 0,
    Value1 = 1,
    Value2 = 2,
    Value3 = 3,
    ...
    Flag1 = 1 << 8,
    Flag2 = 1 << 9,
    FLAGS = Flag1 | Flag2 // Required to identify flags
}

The FLAGS value helps these extension methods to handle flag values:

MixedEnum value = MixedEnum.Value1 | MixedEnum.Flag1,
    valueOnly = value.RemoveFlags(),// == MixedEnum.Value1
    flagsOnly = value.OnlyFlags();// == MixedEnum.Flag1

Unsafe code

The library uses unsafe code. If you don't want/need that, you can compile the library with the NO_UNSAFE compiler constant to disable any unsafe operation. Remember to unset the unsafe compiler option, too!

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages (13)

Showing the top 5 NuGet packages that depend on wan24-Core:

Package Downloads
Stream-Serializer-Extensions

Serializer extensions for .NET Stream objects.

wan24-Compression

Compression helper

wan24-Crypto

Crypto helper

wan24-Crypto-BC

Bouncy Castle adoption to wan24-Crypto

wan24-Compression-LZ4

LZ4 adoption for wan24-Compression

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.25.0 41 5/26/2024
2.24.0 83 5/20/2024
2.23.0 93 5/11/2024
2.22.0 134 5/9/2024
2.21.0 104 5/5/2024
2.20.0 111 4/28/2024
2.19.0 121 4/20/2024
2.18.1 112 4/14/2024
2.18.0 143 4/12/2024
2.17.0 93 4/7/2024
2.16.0 179 3/30/2024
2.15.1 94 3/30/2024
2.15.0 85 3/30/2024
2.14.0 108 3/24/2024
2.13.0 116 3/17/2024
2.12.0 123 3/15/2024
2.11.0 110 3/10/2024
2.10.1 84 3/10/2024
2.10.0 170 3/9/2024
2.9.2 146 3/2/2024
2.9.1 93 3/2/2024
2.9.0 121 3/2/2024
2.8.0 108 2/25/2024
2.7.1 97 2/25/2024
2.7.0 86 2/25/2024
2.6.0 206 2/24/2024
2.5.0 93 2/20/2024
2.4.0 99 2/18/2024
2.3.2 130 2/17/2024
2.3.1 93 2/17/2024
2.3.0 94 2/17/2024
2.2.0 279 1/20/2024
2.1.0 97 12/23/2023
2.0.0 165 12/17/2023
1.43.0 126 11/27/2023
1.42.0 214 11/11/2023
1.41.2 95 11/4/2023
1.41.1 88 11/4/2023
1.41.0 94 11/4/2023
1.40.0 196 10/29/2023
1.39.0 209 10/21/2023
1.38.2 122 10/15/2023
1.38.1 240 10/14/2023
1.38.0 110 10/14/2023
1.37.0 110 10/13/2023
1.36.0 246 10/7/2023
1.35.0 161 10/1/2023
1.34.0 140 9/27/2023
1.33.0 100 9/20/2023
1.32.1 238 9/19/2023
1.32.0 92 9/19/2023
1.31.1 129 9/16/2023
1.31.0 140 9/16/2023
1.30.1 220 9/10/2023
1.30.0 108 9/10/2023
1.29.0 206 9/3/2023
1.28.0 119 8/26/2023
1.27.0 119 8/19/2023
1.26.0 137 8/5/2023
1.25.1 225 7/30/2023
1.25.0 209 7/30/2023
1.24.0 327 7/22/2023
1.23.0 111 7/9/2023
1.22.0 114 6/25/2023
1.21.0 133 6/24/2023
1.20.0 135 6/17/2023
1.19.0 173 6/11/2023
1.18.2 133 6/10/2023
1.18.1 126 6/9/2023
1.18.0 287 6/8/2023
1.17.0 119 6/4/2023
1.16.0 398 6/3/2023
1.15.0 259 5/29/2023
1.14.0 127 5/29/2023
1.13.0 122 5/28/2023
1.12.0 269 5/27/2023
1.11.0 124 5/24/2023
1.10.0 122 5/23/2023
1.9.0 107 5/22/2023
1.8.2 259 5/20/2023
1.8.1 131 5/20/2023
1.8.0 128 5/20/2023
1.7.1 143 5/13/2023
1.7.0 170 5/11/2023
1.6.1 1,280 4/26/2023
1.6.0 329 4/25/2023
1.5.0 357 4/22/2023
1.4.0 137 4/22/2023
1.3.0 264 4/16/2023
1.2.0 215 4/10/2023
1.1.0 164 4/7/2023
1.0.1 180 4/1/2023