Sharpify 2.1.0

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

// Install Sharpify as a Cake Tool
#tool nuget:?package=Sharpify&version=2.1.0                

CHANGELOG

v2.1.0

  • Changes to RentedBufferWriter{T}:
    • RenterBufferWriter{T} no longer throws an exception when the initial capacity is set to 0, instead it will just be disabled, this can be checked with the .IsDisabled property. Setting the initial capacity to a negative number will still throw an exception. This change was made to accommodate use cases where a RentedBufferWriter could be used as a return type, before an "invalid" operation, could not be attained, as it would've been required to give a valid capacity in any case, lest you risk a runtime exception. Now you could actually return a "Disabled" RentedBufferWriter if you set the capacity to 0, which intuitively means that the buffer doesn't actually have a backing array, and all operations would throw an exception.
    • To increase it's usability, a method WriteAndAdvance was also added that accepts either a single T or a ReadOnlySpan{T}, it checks if there is enough capacity to write the data to the buffer, if so it writes it and advances the position automatically.
    • A secondary access ref T[] GetReferenceUnsafe was added, to allow passing the inner buffer to methods that write to a ref T[] which previously required using unsafe code to manipulate the pointers. As implied by the name, this uses Unsafe to acquire the reference, and should only be used if you are carful and know what you are doing.
  • Collection extension methods such as ToArrayFast() and ToListFast() were made deprecated, use the ToArray() and ToList() LINQ methods instead, with time they become the fastest possible implementation and will continue to improve, the performance gap is already minimal, and only improves speed, not memory allocations, which makes it negligible.

Deprecation

A lot of features of the package are already deprecated, and some will continue in this direction as Microsoft seems to really focus on improving performance in the latest versions of C#, some methods that this package originally offered to provide a better performance than what is already in core language, will instead provide worse performance, at which point they've served their purpose.

As such, in the next major versions, many of these features will be removed. To avoid breaking old codebases, for example for .NET 7 users, the best way forward would be to stop supporting this .NET version in the future versions of Sharpify, this means that existing users will still have what they used, but the users of the newer technologies will be able to use newer versions of Sharpify that rely on said technologies to remain dynamic, and stay ahead on the performance curve. This is the only way that I will be able to implement new features, without worrying about multiple implementations of each feature for each version of .NET just to maintain compatibility.

The coming release of .NET 9 and C# 13 seem like the natural point to start this next chapter, I would've loved to play with the new extension functionality, but seems it will be delayed further. In any case, future features of this package will need to rely on future features from .NET, therefore it makes no sense to keep trying to add support for them in older versions as well.

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

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Sharpify:

Package Downloads
Sharpify.Data

An extension of Sharpify, focused on Data

Sharpify.CommandLineInterface

An extension of Sharpify, focused on creating command line interfaces

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.2.0 374 7/26/2024
2.1.0 87 7/18/2024
2.0.0 135 6/3/2024
1.8.1 107 5/30/2024
1.8.0 114 4/17/2024
1.7.3 176 1/29/2024
1.7.2 121 1/23/2024
1.7.1 228 1/20/2024
1.7.0 95 1/20/2024
1.6.0 130 1/15/2024
1.5.0 112 1/10/2024
1.4.2 120 1/8/2024
1.4.1 162 1/4/2024
1.4.0 143 1/4/2024
1.3.1 133 12/31/2023
1.3.0 132 12/31/2023
1.2.0 134 12/24/2023
1.1.0 155 12/7/2023
1.0.9 118 12/7/2023
1.0.8 156 11/22/2023
1.0.7 129 9/23/2023
1.0.6 148 8/21/2023
1.0.5 164 5/4/2023
1.0.4 159 4/23/2023
1.0.3 168 4/19/2023
1.0.2 172 4/19/2023
1.0.1 180 4/14/2023
1.0.0 176 4/14/2023