Friday, December 9, 2016

Convert protobuf to base64

using System;
using p = Google.Protobuf;

namespace TestProtobuf
    class MainClass
        public static void Main(string[] args)

            var c = new Person 
                FirstName = "Anders", LastName = "Hejlsberg"

            int n = c.CalculateSize();
            var ba = new byte[n];

            var os = new p.CodedOutputStream(ba);


            var s = Convert.ToBase64String(ba);


1 comment:

  1. This is very interesting, You are a very skilled blogger.
    I have joined your feed and look forward to seeking more of your fantastic
    post. Also, I have shared your website in my
    social networks!