Example #1
0
        public static object FastSetDictionaryValueOptimized(PythonType type, ref PythonDictionary dict, string name, object value, int keysVersion, int index)
        {
            if (dict == null)
            {
                Interlocked.CompareExchange(ref dict, type.MakeDictionary(), null);
            }

            CustomInstanceDictionaryStorage storage;

            if ((storage = dict._storage as CustomInstanceDictionaryStorage) != null && storage.KeyVersion == keysVersion)
            {
                storage.SetExtraValue(index, value);
                return(value);
            }
            else
            {
                return(dict[name] = value);
            }
        }