BytePack 1.0.2

dotnet add package BytePack --version 1.0.2                
NuGet\Install-Package BytePack -Version 1.0.2                
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="BytePack" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BytePack --version 1.0.2                
#r "nuget: BytePack, 1.0.2"                
#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 BytePack as a Cake Addin
#addin nuget:?package=BytePack&version=1.0.2

// Install BytePack as a Cake Tool
#tool nuget:?package=BytePack&version=1.0.2                

BytePack

Light-weight, manual serialization.

BytePack is a simple light-weight tool that allows you to manually serialize and deserialize your .NET objects.

Quick Start

To serialize objects, simply "Add" your objects one-by-one to a new BytePack and then "Pack" them into a single byte[]:

BytePackage.BytePack pack = new BytePackage.BytePack();
pack.AddInt(123);
pack.AddString("hello");
pack.AddDoubles(new[] { 1.2, 1.3, 1.4 });
byte[] bytes = pack.Pack();

To deserialize objects, simply "Read" the objects from a BytePack in the same order they were originally added during serialization:

BytePackage.BytePack read = BytePackage.BytePack.Read(bytes);
int i = read.ReadInt();
string s = read.ReadString();
double[] d = read.ReadDoubles();

Console.WriteLine("int is: " + i);
Console.WriteLine("string is: " + s);
Console.WriteLine("doubles are: " + d[0] + ", " + d[1] + ", " + d[2]);

Installing

BytePack is available as a NuGet package: https://www.nuget.org/packages/BytePack/

How it works

BytePack binary-serializes the objects that you add based on their type using built-in .NET methods (e.g. System.BitConverter) and keeps them in an ordered list. When you call BytePack.Pack(), these individual arrays are concatenated to a single larger one.

Usage

There are many different tools available for object-serialization in .NET. BytePack has some advantages and disadvantages.

Advantages

  • It is extremely simple and your code is easy-to-read and easy-to-understand - there is no magic happening via Reflection or any other non-obvious means.
  • Serialized objects are typically very small compared to text-based serialization, such as JSON.
  • Serialization and deserialization are relatively fast operations.
  • It is easy and obvious how you can customize the serialization of your objects however you like.

Disadvantages

  • Serialized objects are not human-readable.
  • Serialized objects contain no metadata with instructions for deserialization. You have to know how they were serialized in order to properly deserialize them.
  • Less open-minded colleagues of yours may criticize you for not using something more "standard" like protocol buffers.
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on BytePack:

Package Downloads
Observatory.Standard

Data visualization for engineers.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 34,212 9/21/2022
1.0.1 239 9/21/2022
1.0.0 229 9/21/2022