//Protobuffer从MemoryStream进行反序列化 public bool FromMemoryStream(MemoryStream protoMS) { MailRpcNewMailNotify pb = ProtoBuf.Serializer.Deserialize <MailRpcNewMailNotify>(protoMS); FromPB(pb); return(true); }
//转化成Protobuffer类型函数 public MailRpcNewMailNotify ToPB() { MailRpcNewMailNotify v = new MailRpcNewMailNotify(); for (int i = 0; i < (int)m_MailHeadList.Count; i++) { v.MailHeadList.Add(m_MailHeadList[i].ToPB()); } return(v); }
//从Protobuffer类型初始化 public void FromPB(MailRpcNewMailNotify v) { if (v == null) { return; } m_MailHeadList.Clear(); for (int i = 0; i < v.MailHeadList.Count; i++) { m_MailHeadList.Add(new MailHeadObjWraper()); } for (int i = 0; i < v.MailHeadList.Count; i++) { m_MailHeadList[i].FromPB(v.MailHeadList[i]); } }