BinaryBuffers 3.0.0

There is a newer version of this package available.
See the version list below for details.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package BinaryBuffers --version 3.0.0
                    
NuGet\Install-Package BinaryBuffers -Version 3.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="BinaryBuffers" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BinaryBuffers" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="BinaryBuffers" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BinaryBuffers --version 3.0.0
                    
#r "nuget: BinaryBuffers, 3.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.
#:package BinaryBuffers@3.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BinaryBuffers&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=BinaryBuffers&version=3.0.0
                    
Install as a Cake Tool

BinaryBuffers

logo

NuGet

BinaryBuffers offers a highly performant implementation of BinaryReader and BinaryWriter, working directly on a byte array, thus eliminating the need for an intermediate Stream object.

How to use

BinaryBufferReader and BinaryBufferWriter are the respective names of the reader and writer. Both classes operate on a byte[] as its underlying data buffer.

// Provide a buffer to the reader/writer
var buffer = new byte[100];

// Write to the buffer
var writer = new BinaryBufferWriter(buffer);

writer.Write(2019);
writer.Write(8.11);

// Read from the buffer
var reader = new BinaryBufferReader(buffer);

var year = reader.ReadInt32();
var time = reader.ReadDouble();

Benchmarks

Performance tests were executed using .NET 6 running on a machine with a 16-core CPU.

<table style="width: 100%"> <thead> <tr> <th colspan="5"><span style="font-size: 20px;">BinaryBufferReader</span></th> </tr> <tr> <th>Method</th> <th>Mean</th> <th>Error</th> <th>StdDev</th> <th>Ratio</th> </tr> </thead> <tbody> <tr> <td><code>BinaryReader_ReadInt</code></td> <td>39.08 ms</td> <td>0.563 ms</td> <td>0.527 ms</td> <td><em>baseline</em></td> </tr> <tr> <td><code>BufferReader_ReadInt</code></td> <td>33.80 ms</td> <td>0.055 ms</td> <td>0.049 ms</td> <td style="text-align: right;">-14%</td> </tr> <tr> <th colspan="5"><span style="font-size: 20px;"></span></th> </tr> <tr> <td><code>BinaryReader_ReadDecimal</code></td> <td>44.93 ms</td> <td>0.275 ms</td> <td>0.244 ms</td> <td><em>baseline</em></td> </tr> <tr> <td><code>BufferReader_ReadDecimal</code></td> <td>37.73 ms</td> <td>0.079 ms</td> <td>0.074 ms</td> <td style="text-align: right;">-16%</td> </tr> <tr> <th colspan="5"><span style="font-size: 20px;"></span></th> </tr> <tr> <td><code>BinaryReader_ReadFloat</code></td> <td>22.48 ms</td> <td>0.051 ms</td> <td>0.047 ms</td> <td><em>baseline</em></td> </tr> <tr> <td><code>BufferReader_ReadFloat</code></td> <td>19.05 ms</td> <td>0.016 ms</td> <td>0.014 ms</td> <td style="text-align: right;">-13%</td> </tr> <tr> <th colspan="5"><span style="font-size: 20px;"></span></th> </tr> </tbody> <thead> <tr> <th colspan="5"><span style="font-size: 20px;">BinaryBufferWriter</span></th> </tr> <tr> <th>Method</th> <th>Mean</th> <th>Error</th> <th>StdDev</th> <th>Ratio</th> </tr> </thead> <tbody> <tr> <td><code>BinaryWriter_WriteInt</code></td> <td>66.61 ms</td> <td>0.102 ms</td> <td>0.096 ms</td> <td><em>baseline</em></td> </tr> <tr> <td><code>BufferWriter_WriteInt</code></td> <td>33.77 ms</td> <td>0.085 ms</td> <td>0.075 ms</td> <td style="text-align: right;">-49%</td> </tr> <tr> <th colspan="5"><span style="font-size: 20px;"></span></th> </tr> <tr> <td><code>BinaryWriter_WriteDecimal</code></td> <td>41.44 ms</td> <td>0.159 ms</td> <td>0.149 ms</td> <td><em>baseline</em></td> </tr> <tr> <td><code>BufferWriter_WriteDecimal</code></td> <td>17.14 ms</td> <td>0.047 ms</td> <td>0.044 ms</td> <td style="text-align: right;">-59%</td> </tr> <tr> <th colspan="5"><span style="font-size: 20px;"></span></th> </tr> <tr> <td><code>BinaryWriter_WriteFloat</code></td> <td>33.94 ms</td> <td>0.080 ms</td> <td>0.071 ms</td> <td><em>baseline</em></td> </tr> <tr> <td><code>BufferWriter_WriteFloat</code></td> <td>18.08 ms</td> <td>0.051 ms</td> <td>0.047 ms</td> <td style="text-align: right;">-47%</td> </tr> </tbody> </table>

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

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on BinaryBuffers:

Package Downloads
LiteCDF

A high performance compound document format (CDF) reader.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.1.0 116 12/11/2025
4.0.0 270 11/16/2025
3.0.1 280 6/13/2024
2.0.2 1,241 6/19/2022