예제 #1
0
        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);
            }
        }
예제 #2
0
        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);
        }
예제 #3
0
 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);
     }
 }
예제 #4
0
 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;
 }