JackNino.MessageSerializer
0.0.1
dotnet add package JackNino.MessageSerializer --version 0.0.1
NuGet\Install-Package JackNino.MessageSerializer -Version 0.0.1
<PackageReference Include="JackNino.MessageSerializer" Version="0.0.1" />
<PackageVersion Include="JackNino.MessageSerializer" Version="0.0.1" />
<PackageReference Include="JackNino.MessageSerializer" />
paket add JackNino.MessageSerializer --version 0.0.1
#r "nuget: JackNino.MessageSerializer, 0.0.1"
#:package JackNino.MessageSerializer@0.0.1
#addin nuget:?package=JackNino.MessageSerializer&version=0.0.1
#tool nuget:?package=JackNino.MessageSerializer&version=0.0.1
Introduction
NOTE: The documentation is a work in progress and is being integrated into GitHub Pages here: https://jacknino.github.io/MessageSerializer/:
The MessageSerializer is intended to allow the user to define a class in C# that corresponds to a message that will actually be sent/received as a string of bytes. The MessageSerializer is designed to do the conversion from the string of bytes into the class and vice-versa.
Currently the structure of the message can either be defined purely through the class definition and a series of attributes or through an XML definition.
Note: The MessageSerializer uses Reflection to determine how to process messages.
When using the attribute method of loading the class description it uses an unofficial feature
that presumes that when reflecting through a class the properties will be returned in order. .NET does not actually guarantee
that will be the case but it seems to hold true in practice. If this is a concern, use the XML
file method of defining your class
Example
As a very simple example take this example message:
[1 byte MessageType][1 byte Length][2 bytes Id]
We will say the MessageType is 0x23 and the Id is 0x1234. The length is the length of the rest of the message, so 2. For this example we will say that multi-byte values are sent LSB.
In that case the message being sent would be:
[0x23][0x02][0x34][0x12]
To declare a class for this message you could use:
public class SampleMessage : IMessageSerializable
{
public byte MessageType { get; set; }
public byte Length { get; set; }
public ushort Id { get; set; }
}
Then to use the class:
using MessageSerializer;
SampleMessage sampleMessage = new SampleMessage();
sampleMessage.MessageType = 0x23;
sampleMessage.Id = 0x1234;
byte[] sampleMessageSerialized = Serializer.Instance.Serialize(sampleMessage);
SampleMessage sampleMessageDeserialized = Serializer.Instance.Deserialize<SampleMessage>(sampleMessageSerialized);
Features
The MessageSerializer can help you with a variety of difficulties you might run into when trying to serialize/deserialize a byte oriented message.
- Dealing with variable length fields
- Calculating and setting length fields
- Calculating and setting CRCs and other message authentication codes
- Dealing with different data formats like BCD
- Dealing with little/big endianess
- Encrypting messages
- Creating a ToString that will nicely show the fields of the message
| 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 | 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 | net40 is compatible. net403 was computed. net45 was computed. net451 was computed. net452 was computed. net46 was computed. 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. |
-
.NETFramework 4.0
- No dependencies.
-
.NETStandard 2.0
- Basic.Reference.Assemblies (>= 1.0.0)
- Microsoft.CodeAnalysis (>= 3.8.0)
- System.CodeDom (>= 9.0.10)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.0.1 | 161 | 4/17/2026 |
| 0.0.1-main.55.sha.0751aad | 61 | 4/17/2026 |
| 0.0.1-featureaddnuget.48... | 66 | 4/14/2026 |
| 0.0.1-featureaddnuget.47... | 73 | 4/14/2026 |