Skip to content
This repository has been archived by the owner on Nov 14, 2022. It is now read-only.

lukasz-pyrzyk/BinaryFormatter

Repository files navigation

BinaryFormatter NuGet version

BinaryFormatter is a byte serialized/deserializer for .NET Core, created for Distributed Cache Platform - Kronos. After few days of development, Protobuf-Net (contract base serializer, fork of Google Protobuf) has announcement support for .NET Core.

Build status

Windows Linux
Build status Build Status

Supported types

  • char
  • (s)byte
  • (u)short
  • (u)int
  • (u)long
  • float
  • double
  • bool
  • decimal
  • DateTime
  • TimeSpan
  • byte[]
  • classes
  • collections
    • IEnumarable
    • IDictionary
    • LinkedList
  • structures
  • guid
  • uri
  • enum
  • KeyValuePair
  • BigInteger

Not supported types

  • anonymous types
  • HashSet
  • Array[,], Array[,,], Array[,,,] types
  • DateTimeOffset
  • Nullable

Installation

$ Install-Package BinaryFormatter

Serialization

var converter = new BinaryConverter();
byte[] byteArray = converter.Serialize(model);

Deserialization

var converter = new BinaryConverter();
ViewModel obj = converter.Deserialize<ViewModel>(byteArray);

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so we don't break it in a future version unintentionally.
  • Send a pull request. Bonus points for topic branches.

License

MIT