public static void Copy <T, TCopy>(DictionaryInt <T> fromDic, ref DictionaryInt <T> dic, TCopy copy) where TCopy : IArrayElementCopy <T> { if (fromDic == null) { if (dic != null) { foreach (var kv in dic) { copy.Recycle(kv.Value); } PoolDictionaryInt <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); } PoolDictionaryInt <T> .Recycle(ref dic); } dic = PoolDictionaryInt <T> .Spawn(fromDic.Count); } dic.CopyFrom(fromDic, copy); }
public static void Copy <T>(DictionaryInt <T> fromDic, ref DictionaryInt <T> dic) { if (fromDic == null) { if (dic != null) { PoolDictionaryInt <T> .Recycle(ref dic); } dic = null; return; } if (dic == null || fromDic.Count != dic.Count) { if (dic != null) { PoolDictionaryInt <T> .Recycle(ref dic); } dic = PoolDictionaryInt <T> .Spawn(fromDic.Count); } dic.CopyFrom(fromDic); }