示例#1
0
        public static void Copy <T, TCopy>(DictionaryULong <T> fromDic, ref DictionaryULong <T> dic, TCopy copy) where TCopy : IArrayElementCopy <T>
        {
            if (fromDic == null)
            {
                if (dic != null)
                {
                    foreach (var kv in dic)
                    {
                        copy.Recycle(kv.Value);
                    }

                    PoolDictionaryULong <T> .Recycle(ref dic);
                }

                dic = null;
                return;
            }

            if (dic == null || fromDic.Count != dic.Count)
            {
                if (dic != null)
                {
                    foreach (var kv in dic)
                    {
                        copy.Recycle(kv.Value);
                    }

                    PoolDictionaryULong <T> .Recycle(ref dic);
                }

                dic = PoolDictionaryULong <T> .Spawn(fromDic.Count);
            }

            dic.CopyFrom(fromDic, copy);
        }
示例#2
0
        public static void Copy <T>(DictionaryULong <T> fromDic, ref DictionaryULong <T> dic)
        {
            if (fromDic == null)
            {
                if (dic != null)
                {
                    PoolDictionaryULong <T> .Recycle(ref dic);
                }

                dic = null;
                return;
            }

            if (dic == null || fromDic.Count != dic.Count)
            {
                if (dic != null)
                {
                    PoolDictionaryULong <T> .Recycle(ref dic);
                }

                dic = PoolDictionaryULong <T> .Spawn(fromDic.Count);
            }

            dic.CopyFrom(fromDic);
        }