예제 #1
0
        public static BigInteger AddRaw(this StorageList list, byte[] bytes)
        {
            var index = list.Count();

            list.Context.Put(CountKey(list.BaseKey), index + 1);

            list.ReplaceRaw(index, bytes);
            return(index);
        }
예제 #2
0
        public static void RemoveAt(this StorageList list, BigInteger index)
        {
            var size = list.Count();

            if (index < 0 || index >= size)
            {
                throw new StorageException("outside of range");
            }

            size = size - 1;

            if (size > index)
            {
                var last = list.GetRaw(size);
                list.ReplaceRaw(index, last);
            }

            var key = ElementKey(list.BaseKey, size);

            list.Context.Delete(key);

            list.Context.Put(CountKey(list.BaseKey), size);
        }