Skip to content
mhdsbqPublic

About

A toy implementation of google protobuf codec in c# for c#

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

21 Commits

Folders and files

Repository files navigation

ToyProto

A simple toy implementation of protobuf in C# for C#

Includes

  • a simple code generator (ToyProto.Compiler) that generates c# code from a .proto file
  • a simple runtime library for c# (ToyProto.Runtime)
  • a simple command line tool (ToyProto.Cli) that can be used to compile .proto files and encode or decode messages to and from json

Supported features

  • TBD

Usage

Command line tool

  • toyproto compile <proto file> -o <output directory>
  • toyproto encode <proto file> -i <input json file> -o <output binary file>
  • toyproto decode <proto file> -i <input binary file> -o <output json file>

C# generated code

using ToyProto.Runtime;

var person = new Person
{
    Name = "John Doe",
    Age = 30,
    Email = "john.doe@example.com"
};

var bytes = person.Encode();
var decodedPerson = Person.Decode(bytes);
Console.WriteLine(decodedPerson.Name); // Output: John Doe

Development

Prerequisites

Install cli

task install-cli
  • now you can run the cli tool with toyproto command

About

A toy implementation of google protobuf codec in c# for c#

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages