示例#1
0
        public static bool DoRead <T>(IReader reader, ref List <T> val, string name, ReadCallback <T> call)
            where T : new()
        {
            int size = 0;

            if (!reader.ArrayBegin(ref size, name))
            {
                return(false);
            }

            for (int i = 0; i < size; ++i)
            {
                T tmp = new T();
                call(reader, ref tmp, null);
                val.Add(tmp);
            }

            return(reader.ArrayEnd());
        }
示例#2
0
        public static bool Read <T>(IReader reader, ref List <T> lst, string name = null)
        {
            int size = 0;

            if (!reader.ArrayBegin(ref size, name))
            {
                return(false);
            }

            for (int i = 0; i < size; ++i)
            {
                T tmp = default(T);
                if (!Read(reader, ref tmp))
                {
                    return(false);
                }

                lst.Add(tmp);
            }

            return(reader.ArrayEnd());
        }