using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ProtoBuf;
using System.IO;
namespace CsharpProtobuf
{
class Program
{
static void Main(string[] args)
{
PersonInfo item = new PersonInfo() { name = "小明", age = 20, phone_num = 13521634420 };
byte[] temp = Serialize(item);
Console.WriteLine("序列化之后的长度 = " + temp.Length);
PersonInfo newItem = DeSerialize(temp);
Console.WriteLine(string.Format("名字 = {0} 年龄 = {1} 手机号 = {2}", newItem.name, newItem.age, newItem.phone_num));
Console.ReadKey();
}
private static byte[] Serialize(PersonInfo model)
{
try
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ProtoBuf;
using System.IO;
namespace CsharpProtobuf
{
class Program
{
static void Main(string[] args)
{
PersonInfo item = new PersonInfo() { name = "小明", age = 20, phone_num = 13521634420 };
byte[] temp = Serialize(item);
Console.WriteLine("序列化之后的长度 = " + temp.Length);
PersonInfo newItem = DeSerialize(temp);
Console.WriteLine(string.Format("名字 = {0} 年龄 = {1} 手机号 = {2}", newItem.name, newItem.age, newItem.phone_num));
Console.ReadKey();
}
private static byte[] Serialize(PersonInfo model)
{
try