c#中想将一个hashtable的元素全部给另一个hashbale时,

使用迭代一个一个元素赋值

如:

ammus.Clear();
IDictionaryEnumerator ie = _temp.GetEnumerator();

while (ie.MoveNext())
ammus.Add(ie.Key,ie.Value);

 

直接变量赋值会导致其他脚本中引用原变量的操作无效,猜测只是指针地址变更。

如:

ammus = _temp;

相关文章:

  • 2022-02-28
  • 2022-02-06
  • 2022-12-23
  • 2021-10-06
  • 2021-06-14
  • 2021-07-29
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-03
  • 2021-12-26
  • 2021-11-04
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案