//Protobuffer从MemoryStream进行反序列化 public bool FromMemoryStream(MemoryStream protoMS) { FriendRpcRecommendObj pb = ProtoBuf.Serializer.Deserialize <FriendRpcRecommendObj>(protoMS); FromPB(pb); return(true); }
//从Protobuffer类型初始化 public void FromPB(FriendRpcRecommendObj v) { if (v == null) { return; } m_UserId = v.UserId; m_UserName = v.UserName; m_Level = v.Level; m_Prof = v.Prof; }
//转化成Protobuffer类型函数 public FriendRpcRecommendObj ToPB() { FriendRpcRecommendObj v = new FriendRpcRecommendObj(); v.UserId = m_UserId; v.UserName = m_UserName; v.Level = m_Level; v.Prof = m_Prof; return(v); }