UBinarySerializer 0.0.3-alpha

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

// Install UBinarySerializer as a Cake Tool
#tool nuget:?package=UBinarySerializer&version=0.0.3-alpha&prerelease                

UBinarySerializer

Framework for data binary serialization.

Getting started.

To create serializer for specific object type, you need to create BinarySerializer<> instance:

BinarySerializer<MyObject> serializer = new BinarySerializer<MyObject>();

Then to serialize object to binary data use Serialize or SerializeUnsafe methods.

Difference between them, is that Serialize method serializes the data safely, allows to serialize null-reference objects and saves object data version (generation) for backward-compatibility.
SerializeUnsafe optimized for fast serialization, and disallows null-references.

To control fields and properties during serialization use BinIndexAttribute:

using System;
using NullSoftware.Serialization;

public class Player
{
    [BinIndex(0)]
    public int Health { get; set; }

    [BinIndex(1, Generation = 2)]
    public int Hunger { get; set; }

    [BinIndex(2)]
    public Vector3 Postion { get; set; }

    [BinIndex(3)]
    public GameMode GameMode { get; set; }

    [BinIndex(4)]
    public Texture Skin { get; set; }

    [BinIndex(5)]
    public List<Item> Items { get; set; }
        = new List<Item>();
    
    public int DeathsCount { get; set; } // will not be serialized.
}

Generation allows to add new fields/properties for already serialized object without breaking serialization (in case if Serialize method was used). If there is no BinIndexAttribute specified in object will be serialized all not-readonly fields/properties.

Also can be used RequiredAttribute from System.ComponentModel.DataAnnotations to specify that current field/property can not have null-reference even in 'safe' serialization.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  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 netcoreapp3.0 is compatible.  netcoreapp3.1 is compatible. 
.NET Framework net45 is compatible.  net451 is compatible.  net452 is compatible.  net46 is compatible.  net461 is compatible.  net462 is compatible.  net463 was computed.  net47 is compatible.  net471 is compatible.  net472 is compatible.  net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 3.0

    • No dependencies.
  • .NETCoreApp 3.1

    • No dependencies.
  • .NETFramework 4.5

    • No dependencies.
  • .NETFramework 4.5.1

    • No dependencies.
  • .NETFramework 4.5.2

    • No dependencies.
  • .NETFramework 4.6

    • No dependencies.
  • .NETFramework 4.6.1

    • No dependencies.
  • .NETFramework 4.6.2

    • No dependencies.
  • .NETFramework 4.7

    • No dependencies.
  • .NETFramework 4.7.1

    • No dependencies.
  • .NETFramework 4.7.2

    • No dependencies.
  • .NETFramework 4.8

    • No dependencies.
  • net5.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Fixed bug with custom converters for abstract type.