ByteSerialization 0.0.1-alpha.11
dotnet add package ByteSerialization --version 0.0.1-alpha.11
NuGet\Install-Package ByteSerialization -Version 0.0.1-alpha.11
<PackageReference Include="ByteSerialization" Version="0.0.1-alpha.11" />
<PackageVersion Include="ByteSerialization" Version="0.0.1-alpha.11" />
<PackageReference Include="ByteSerialization" />
paket add ByteSerialization --version 0.0.1-alpha.11
#r "nuget: ByteSerialization, 0.0.1-alpha.11"
#:package ByteSerialization@0.0.1-alpha.11
#addin nuget:?package=ByteSerialization&version=0.0.1-alpha.11&prerelease
#tool nuget:?package=ByteSerialization&version=0.0.1-alpha.11&prerelease
ByteSerialization
A declarative serialization library designed for bit-perfect control over binary representation. You can define C# classes like C structs by assigning attributes to classes and properties. Inspired by BinarySerializer by Jeff Haynes.
This library was created from the ground up to support features like references/pointers.
Notably, this libary is used by swe1r-assets.
Example
Consider the following classes:
public class Manufacturer
{
[Order(0)]
public byte NameLength { get; set; }
[Order(1), Length(nameof(NameLength))]
public char[] Name { get; set; }
}
public class Car
{
[Order(0)]
public byte NameLength { get; set; }
[Order(1), Length(nameof(NameLength))]
public char[] Name { get; set; }
[Order(2), Reference]
public Manufacturer Manufacturer { get; set; }
}
Create an object graph like this:
var mf = new Manufacturer() { NameLength = 2, Name = "MF".ToArray() };
var car = new Car() { NameLength = 4, Name = "Car1".ToArray(), Manufacturer = mf };
using (var ms = new MemoryStream())
{
new ByteSerializer().Serialize(ms, car, Endianness.BigEndian);
File.WriteAllBytes("car.bin", ms.ToArray());
}
That gives you the following binary output:
$ xxd car.bin
00000000: 0443 6172 3100 0000 0902 4d46 .Car1.....MF
| Bytes | Property | Value |
|---|---|---|
| 04 | car.NameLength | 4 |
| 43 61 72 31 | car.Name | "Car1" in ASCII |
| 00 00 00 09 | car.Manufacturer | (pointer to mf) |
| 02 | mf.NameLength | 2 |
| 4d 46 | mf.Name | "MF" in ASCII |
| Product | Versions 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. 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. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- AKopetsch.IOHelper (>= 0.1.0-alpha.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on ByteSerialization:
| Package | Downloads |
|---|---|
|
SWE1R.Assets.Blocks
A library for handling game assets of Star Wars Episode 1 Racer. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.0.1-alpha.11 | 74 | 1/27/2025 |
| 0.0.1-alpha.10 | 75 | 7/12/2024 |
| 0.0.1-alpha.9 | 118 | 6/21/2024 |
| 0.0.1-alpha.8 | 98 | 6/20/2024 |
| 0.0.1-alpha.7 | 86 | 6/17/2024 |
| 0.0.1-alpha.6 | 92 | 6/17/2024 |
| 0.0.1-alpha.5 | 92 | 6/4/2024 |
| 0.0.1-alpha.4 | 81 | 6/4/2024 |
| 0.0.1-alpha.3 | 78 | 6/4/2024 |
| 0.0.1-alpha.2 | 91 | 5/31/2024 |
| 0.0.1-alpha.1 | 86 | 5/30/2024 |
| 0.0.1-alpha.0 | 92 | 5/29/2024 |