Esempio n. 1
0
        private static void SaveList(Pickler /*!*/ pickler, object obj)
        {
            Debug.Assert(obj.GetType() == typeof(List <object>), "arg must be list");
            Debug.Assert(!pickler.MemoContains(obj));

            int index = pickler.MemoizeNew(obj);

            pickler.Write(Opcode.EmptyList);

            pickler.WritePut(index);
            pickler.BatchAppends(((IEnumerable)obj).GetEnumerator());
        }
Esempio n. 2
0
        private static void SaveDict(Pickler /*!*/ pickler, object obj)
        {
            Debug.Assert(obj.GetType() == typeof(Dictionary <string, object>), "arg must be dict");
            Debug.Assert(!pickler.MemoContains(obj));

            int index = pickler.MemoizeNew(obj);

            pickler.Write(Opcode.EmptyDict);

            pickler.WritePut(index);

            pickler.BatchSetItems((Dictionary <string, object>)obj);
        }