cloudflight
2024-06-10 4db7d08bb295be33e80f1353f58fcea4a8da6127
Hydraulic/Hydro.CommonBase/component/dict.cs
@@ -56,7 +56,7 @@
            }
        }
        public bool emptyCreate = false;
        public bool emptyCreate = true;
        //List<dict> _list = null;
        public dict() : base()
        {
@@ -155,14 +155,38 @@
        {
            get
            {
                if (!this.ContainsKey(key)) this.Add(key, default(TValue));
                if (!this.ContainsKey(key))
                {
                    lock (this)
                    {
                        if (!this.ContainsKey(key))
                        {
                            if (emptyCreate)
                                this.Add(key, default(TValue));
                            else
                                return default(TValue);
                        }
                    }
                }
                return base[key];
            }
            set
            {
                if (this.ContainsKey(key)) base[key] = value;
                else this.Add(key, value);
                if (!this.ContainsKey(key))
                {
                    lock (this)
                    {
                        if (!this.ContainsKey(key))
                        {
                            if (emptyCreate)
                                this.Add(key, value);
                            else
                                return;
                        }
                    }
                }
                base[key] = value;
            }
        }