internal void WriteList(MProto proto, MioList meta, List <object> data) { if (data == null) { proto.WriteListBegin(new MList(meta.Element.Type, 0)); return; } var list = new MList(meta.Element.Type, data.Count); proto.WriteListBegin(list); foreach (var elem in data) { Write(proto, meta.Element, elem); } }
internal List <object> ReadList(MProto proto, MioList meta) { if (meta == null) { return(null); } var list = proto.ReadListBegin(); if (list.ElementType != meta.Element.Type) { SkipList(proto, list); return(null); } var res = new List <object>(); for (int i = 0; i < list.Count; i++) { var obj = Read(proto, meta.Element); res.Add(obj); } return(res); }
internal void WriteList(MProto proto, MioList meta, List<object> data) { if (data == null) { proto.WriteListBegin(new MList(meta.Element.Type, 0)); return; } var list = new MList(meta.Element.Type, data.Count); proto.WriteListBegin(list); foreach (var elem in data) { Write(proto, meta.Element, elem); } }
internal List<object> ReadList(MProto proto, MioList meta) { if (meta == null) return null; var list = proto.ReadListBegin(); if (list.ElementType != meta.Element.Type) { SkipList(proto, list); return null; } var res = new List<object>(); for (int i = 0; i < list.Count; i++) { var obj = Read(proto, meta.Element); res.Add(obj); } return res; }