Google Protocol Buffers 使用3.0版本

下载protoc.exe

下载链接

https://github.com/protocolbuffers/protobuf/releases

阅读使用指南

https://developers.google.com/protocol-buffers/docs/csharptutorial

生成命令

protoc -I=. --csharp_out=. ./addressbook.proto

-I 输入当前目录  --csharp_out 输出目录

C# 类型映射

.proto Type Notes C++ Type Java Type Python Type[2] Go Type Ruby Type C# Type PHP Type Dart Type
double   double double float float64 Float double float double
float   float float float float32 Float float float double
int32 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. int32 int int int32 Fixnum or Bignum (as required) int integer int
int64 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. int64 long int/long[3] int64 Bignum long integer/string[5] Int64
uint32 Uses variable-length encoding. uint32 int[1] int/long[3] uint32 Fixnum or Bignum (as required) uint integer int
uint64 Uses variable-length encoding. uint64 long[1] int/long[3] uint64 Bignum ulong integer/string[5] Int64
sint32 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. int32 int int int32 Fixnum or Bignum (as required) int integer int
sint64 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. int64 long int/long[3] int64 Bignum long integer/string[5] Int64
fixed32 Always four bytes. More efficient than uint32 if values are often greater than 228. uint32 int[1] int/long[3] uint32 Fixnum or Bignum (as required) uint integer int
fixed64 Always eight bytes. More efficient than uint64 if values are often greater than 256. uint64 long[1] int/long[3] uint64 Bignum ulong integer/string[5] Int64
sfixed32 Always four bytes. int32 int int int32 Fixnum or Bignum (as required) int integer int
sfixed64 Always eight bytes. int64 long int/long[3] int64 Bignum long integer/string[5] Int64
bool   bool boolean bool bool TrueClass/FalseClass bool boolean bool
string A string must always contain UTF-8 encoded or 7-bit ASCII text. string String str/unicode[4] string String (UTF-8) string string String
bytes May contain any arbitrary sequence of bytes. string ByteString str []byte String (ASCII-8BIT) ByteString string List<int>

最新文章

  1. HTML5系列:HTML5绘图
  2. [转]./configure,make,make install的作用
  3. ZeroClipboard 复制到剪贴板
  4. 使用mx:Repeater在删除和添加item时列表闪烁
  5. 【JavaEE企业应用实战学习记录】MyGetAttributeListener
  6. matlab读入矩阵数据
  7. wuzhicms水印的设置
  8. C++问题-UniqueAppObject.cpp(147): error C3861: “GUXClientInit”: 找不到标识符
  9. 六,WPF的Application类
  10. 使用AOP 实现Redis缓存注解,支持SPEL
  11. YZOI Easy Round 2_回文串 string
  12. AngularJS移动开发中的坑汇总
  13. javascript 判断系统设备
  14. innerHTML innerText的使用和区别
  15. JVM菜鸟进阶高手之路九(解惑)
  16. 一日一练-CSS CSS中percentage百分值的使用
  17. 在Linux(Centos7)上使用Docker运行.NetCore
  18. [Swift]LeetCode1009. 十进制整数的补码 | Complement of Base 10 Integer
  19. PHP+Mysql学习笔记
  20. tmux常用配置

热门文章

  1. netsharp.weixin和sdk的配置信息管理
  2. m序列
  3. Nodejs学习笔记:基础
  4. jQuery 2
  5. H.264, MPEG4之间的关系
  6. spring学习九 spring aop详解
  7. php接口 接受ios或android端图片; php接收NSData数据
  8. ext中对json数据的处理解析
  9. 第07章:MongoDB-CRUD操作--文档--创建
  10. BZOJ 1444 [Jsoi2009]有趣的游戏 (AC自动机 + 概率DP + Gauss)