Sharpify 1.0.6
See the version list below for details.
dotnet add package Sharpify --version 1.0.6
NuGet\Install-Package Sharpify -Version 1.0.6
<PackageReference Include="Sharpify" Version="1.0.6" />
<PackageVersion Include="Sharpify" Version="1.0.6" />
<PackageReference Include="Sharpify" />
paket add Sharpify --version 1.0.6
#r "nuget: Sharpify, 1.0.6"
#:package Sharpify@1.0.6
#addin nuget:?package=Sharpify&version=1.0.6
#tool nuget:?package=Sharpify&version=1.0.6
Sharpify
A collection of high performance language extensions for C#
Features
- ๐คท
Either<T0, T1>- Discriminated union object that forces handling of both cases - ๐ฆพ Flexible
Resulttype that can encapsulate any other type and adds a massage options and a success or failure status. Flexible as it doesn't require any special handling to use (unlikeEither) - ๐ Extremely efficient concurrency with
Concurrentcollection wrapper andIAction/IAsyncActioninterfaces - ๐ Wrapper extensions that simplify use of common functions and advanced features from the
CollectionsMarshalclass - ๐งต
ThreadSafe<T>makes any variable type thread-safe - ๐
AesProviderprovides access to industry leading AES-128 encryption with virtually no setup - ๐๏ธ High performance optimized alternative to core language extensions
- ๐ More added features that are not present in the core language
- โParameter validation is handled with
Debug.Assertstatements instead ofExceptionthrowing to increase performance in Release builds
More on Concurrent
The interfaces IAction and IAsyncAction allow usage of readonly structs to represents the actual lambda function alternative, in addition of possibly being allocated on the stack, it also allows usage of readonly field and provides clarity for the JIT compiler allowing it to optimize much more during runtime than if it were lambda functions. The Concurrent wrapper serves 3 purposes: first is separating the extensions of this library from the rest of parallel core extensions, to make sure you really are using the one you want. Second is to limit actual types of collections you could use, In order to maximize the performance only collections that implement ICollection<T> can be used. Third is that wrapping the collection as a field in a ref struct sometimes helps allocate more of the actual processing dependencies on the stack, and most of the time even if not, it will allocate the pointer to the stack which will help the JIT to further optimize during runtime.
More on Result
Result is a readonly record struct that includes a bool status of either success or failure and an optional string message.
In addition to that there is an alternative Result<T> which can also store a value of type T. The result class uses static factory methods to create both Result and Result<T> objects, and implicit converters minimize complexity and unreadability of code.
Unlike Either<T0, T1>, Result does force the user to handle it in any special way, instead nullable properties are used. both Result.Message and Result.Value (if Result<T> is used) can be null, and the factory methods for Fail set the Value to null. So that in the worst case you only allocate a null reference.
All of these design choices guarantee vastly improved performance over Either<T0, T1> since, you can use any objects during the handling of the result, or pass the result entirely or just parts of it between methods without worrying of boxing and heap allocations from lambdas
More on ThreadSafe<T>
- Access the value by using
ThreadSafe<T>.Value - Modify the value by using
ThreadSafe<T>.Modify(Func<T, T>)orThreadSafe<T>.Modify(IModifier<T>) IModifier<T>allows you to create an operation that will be better optimized than aFunc<T, T>and possibly avoid the memory allocation penalty associated withdelegates- Unlike the
Interlockedapi's, which require usingrefthus making them unusable inasyncmethods,ThreadSafe<T>doesn't, which makes it much more usable
More on AesProvider
- Has
stringkey based constructor that takes care of the headache for padding and key size for you - Has methods for encrypting and decrypting both
strings andbyte[]s - Provides an option to generate an
ICryptoTransformfor either encryption or decryption to fit special needs - Properly implements
IDisposablewith api notices to prevent memory leaks - Has static methods for generating hashed passwords and validating them
More on the Utils class
- Adds an option for calculating rolling average for
double - Adds new interfaces to access
DateTime.NowusingGetCurrentTimeAsyncandGetCurrentTimeInBinaryAsync, as using the default ones involves a system call and it is blocking, it actually takes quite a bit of time, from my testing about 180ns, the new functions allow calling to a variable and not awaiting them, then later awaiting the actual variable to either get the value or wait for it to complete and get the value. This allows you to actually do other things while awaiting this system call. It can make a big difference in high-performance scenarios where you use `DateTime.Now to also get a timestamp
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net7.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Sharpify:
| Package | Downloads |
|---|---|
|
Sharpify.Data
An extension of Sharpify, focused on Data |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.1 | 384 | 11/18/2025 |
| 2.5.0 | 1,083 | 11/13/2024 |
| 2.4.0 | 4,036 | 10/21/2024 |
| 2.4.0-alpha | 262 | 10/8/2024 |
| 2.2.0 | 637 | 7/26/2024 |
| 2.1.0 | 168 | 7/18/2024 |
| 2.0.0 | 276 | 6/3/2024 |
| 1.8.1 | 211 | 5/30/2024 |
| 1.8.0 | 198 | 4/17/2024 |
| 1.7.3 | 292 | 1/29/2024 |
| 1.7.2 | 186 | 1/23/2024 |
| 1.7.1 | 408 | 1/20/2024 |
| 1.7.0 | 162 | 1/20/2024 |
| 1.6.0 | 213 | 1/15/2024 |
| 1.5.0 | 226 | 1/10/2024 |
| 1.4.2 | 195 | 1/8/2024 |
| 1.4.1 | 261 | 1/4/2024 |
| 1.4.0 | 228 | 1/4/2024 |
| 1.3.1 | 206 | 12/31/2023 |
| 1.3.0 | 207 | 12/31/2023 |
| 1.2.0 | 210 | 12/24/2023 |
| 1.1.0 | 208 | 12/7/2023 |
| 1.0.9 | 170 | 12/7/2023 |
| 1.0.8 | 212 | 11/22/2023 |
| 1.0.7 | 188 | 9/23/2023 |
| 1.0.6 | 226 | 8/21/2023 |
| 1.0.5 | 265 | 5/4/2023 |
| 1.0.4 | 319 | 4/23/2023 |
| 1.0.3 | 268 | 4/19/2023 |
| 1.0.2 | 273 | 4/19/2023 |
| 1.0.1 | 272 | 4/14/2023 |
| 1.0.0 | 279 | 4/14/2023 |