EonaCat.FastBin
1.0.0
Prefix Reserved
dotnet add package EonaCat.FastBin --version 1.0.0
NuGet\Install-Package EonaCat.FastBin -Version 1.0.0
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="EonaCat.FastBin" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EonaCat.FastBin" Version="1.0.0" />
<PackageReference Include="EonaCat.FastBin" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EonaCat.FastBin --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: EonaCat.FastBin, 1.0.0"
#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.
#:package EonaCat.FastBin@1.0.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EonaCat.FastBin&version=1.0.0
#tool nuget:?package=EonaCat.FastBin&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
EonaCat.FastBin
A blazingly fast, enterprise-grade binary serialization library for .NET with built-in networking capabilities.
๐ Features
- โก Ultra-fast - Binary format optimized for speed, outperforms JSON and MessagePack
- ๐ Complete object graph support - Handles nested objects, circular references, and polymorphism
- ๐ฆ Zero configuration - Works with any type out of the box
- ๐ Built-in networking - TCP client/server with RPC support included
- ๐ฏ Type-safe - Strongly-typed API with full generic support
- ๐ Thread-safe - Safe for concurrent serialization/deserialization
- ๐ฑ Cross-platform - .NET Standard 2.1 compatible
๐ Performance
EonaCat.FastBin uses several optimization techniques to achieve superior performance:
- Binary format - No text parsing overhead
- 7-bit integer encoding - Compact representation of small numbers
- Type caching - Reflection performed only once per type
- Reference tracking - Objects serialized once, referenced thereafter
- Zero-copy operations - Direct memory access where possible
๐ฏ Quick Start
Basic Serialization
using EonaCat.FastBin;
// Serialize any object
var user = new User { Id = 1, Name = "Brasser", Email = "brasser@example.com" };
byte[] data = EonaCat.FastBin.Serialize(user);
// Deserialize back
var restored = EonaCat.FastBin.Deserialize<User>(data);
Complex Objects
// Works with nested objects
var order = new Order
{
OrderId = Guid.NewGuid(),
TotalAmount = 299.99m,
Items = new List<OrderItem>
{
new OrderItem { ProductName = "Laptop", Quantity = 1, Price = 299.99m }
}
};
byte[] data = EonaCat.FastBin.Serialize(order);
var restored = EonaCat.FastBin.Deserialize<Order>(data);
Collections
// Lists
var users = new List<User> { user1, user2, user3 };
byte[] data = EonaCat.FastBin.Serialize(users);
// Dictionaries
var userMap = new Dictionary<int, User>
{
[1] = user1,
[2] = user2
};
byte[] data2 = EonaCat.FastBin.Serialize(userMap);
// Arrays
var userArray = new User[] { user1, user2 };
byte[] data3 = EonaCat.FastBin.Serialize(userArray);
Circular References
// Self-referencing objects work automatically
var manager = new User { Id = 1, Name = "Manager" };
var employee = new User { Id = 2, Name = "Brasser", Manager = manager };
manager.Manager = manager; // Circular reference
byte[] data = EonaCat.FastBin.Serialize(employee);
var restored = EonaCat.FastBin.Deserialize<User>(data);
// Reference integrity maintained
Console.WriteLine(ReferenceEquals(restored.Manager, restored.Manager.Manager)); // True
Polymorphism
// Handles polymorphic types automatically
object[] items = new object[]
{
"A string",
42,
new User { Id = 1, Name = "Brasser" },
new Order { OrderId = Guid.NewGuid() }
};
byte[] data = EonaCat.FastBin.Serialize(items);
var restored = EonaCat.FastBin.Deserialize<object[]>(data);
// Types preserved correctly
Console.WriteLine(restored[0].GetType()); // System.String
Console.WriteLine(restored[2].GetType()); // User
๐ Networking
Server Setup
var server = new FastServer();
// Register handlers
server.RegisterHandler<GetUserRequest, User>("GetUser", request =>
{
// Your business logic here
return database.GetUser(request.UserId);
});
server.RegisterHandler<CreateOrderRequest, CreateOrderResponse>("CreateOrder", async request =>
{
// Async handlers supported
var order = await orderService.CreateOrderAsync(request);
return new CreateOrderResponse { OrderId = order.Id, Message = "Success" };
});
// Start server
await server.StartAsync(5000);
Client Usage
using (var client = new FastClient())
{
await client.ConnectAsync("localhost", 5000);
// Make RPC calls
var user = await client.CallAsync<GetUserRequest, User>(
"GetUser",
new GetUserRequest { UserId = 123 }
);
var response = await client.CallAsync<CreateOrderRequest, CreateOrderResponse>(
"CreateOrder",
new CreateOrderRequest
{
UserId = 123,
Items = orderItems
}
);
}
๐ Supported Types
Primitives
- All numeric types:
byte,sbyte,short,ushort,int,uint,long,ulong,float,double,decimal bool,char,stringDateTime,Guid- Enums
Collections
- Arrays:
T[] - Lists:
List<T>,IList,IList<T> - Dictionaries:
Dictionary<K,V>,IDictionary,IDictionary<K,V>
Complex Types
- Classes (public and non-public fields)
- Structs
- Nested objects
- Generic types
- Polymorphic types
- Self-referencing objects
- Circular references
๐ง Advanced Usage
Custom Domain Models
public class Customer
{
public int Id;
public string Name;
public string Email;
public DateTime CreatedAt;
public Address ShippingAddress;
public List<Order> Orders;
public Customer ReferredBy; // Self-reference supported
}
public class Address
{
public string Street;
public string City;
public string ZipCode;
public string Country;
}
No attributes or special configuration needed - just define your classes normally!
Error Handling (Networking)
try
{
var result = await client.CallAsync<Request, Response>("Route", request);
}
catch (Exception ex)
{
// Handle network errors, deserialization errors, or handler exceptions
Console.WriteLine($"RPC failed: {ex.Message}");
}
Server Shutdown
// Graceful shutdown
server.Stop();
๐๏ธ Architecture
Binary Format
EonaCat.FastBin uses a compact binary format with the following features:
- Type markers - Single byte to identify data type
- 7-bit encoding - Variable-length integers for efficiency
- Reference tracking - Objects assigned IDs, referenced by ID on subsequent encounters
- Type polymorphism - Actual type stored when different from declared type
- Field ordering - Consistent ordering by name for versioning
Networking Protocol
- Message framing - 4-byte length prefix
- Request/Response - Structured messages with route and data
- Error handling - Exceptions marshaled back to client
- Type safety - Generic request/response types
โ ๏ธ Limitations & Considerations
- Private fields - Serializes all fields (public and private)
- Properties - Only backing fields are serialized
- Versioning - Adding/removing fields requires redeployment (no built-in versioning)
- Security - No encryption built-in (use TLS/SSL at transport layer)
- Large objects - Keep network messages under 2GB (int.MaxValue)
๐งช Testing
The included example application demonstrates:
- โ Basic serialization of primitives and collections
- โ Complex nested object graphs
- โ Self-referencing and circular references
- โ Polymorphic type handling
- โ Client-server RPC communication
๐ Migration Guide
From JSON.NET
// Before (JSON.NET)
string json = JsonConvert.SerializeObject(obj);
var restored = JsonConvert.DeserializeObject<T>(json);
// After (EonaCat.FastBin)
byte[] data = FastBin.Serialize(obj);
var restored = FastBin.Deserialize<T>(data);
From MessagePack
// Before (MessagePack)
byte[] data = MessagePackSerializer.Serialize(obj);
var restored = MessagePackSerializer.Deserialize<T>(data);
// After (EonaCat.FastBin) - Same API!
byte[] data = FastBin.Serialize(obj);
var restored = FastBin.Deserialize<T>(data);
๐ Best Practices
- Reuse clients - Create one
FastClientper connection, reuse for multiple calls - Dispose properly - Always dispose clients:
using (var client = new FastClient()) - Handler registration - Register all handlers before calling
StartAsync() - Error handling - Always wrap RPC calls in try-catch
- Thread safety -
FastBinclass is thread-safe, instances are not - Network timeout - Implement timeouts at the TCP socket level if needed
| 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- 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.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 198 | 11/1/2025 |
With EonaCat.FastBin you can serialize and deserialize fast and efficiently.