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()); }
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()); }