A method to realize deep copy of Hashtable

mac2022-06-30  77

 1  protected   void  CopyHash(Hashtable src,  out  Hashtable dst)  2  {  3      MemoryStream ms  =   new  MemoryStream();  4   5      BinaryFormatter bf  =   new  BinaryFormatter();  6   7       // serialize source to a stream  8      bf.Serialize(ms, src);  9  10       // deserialize it to the copy 11      ms.Seek( 0 0 ); 12  13      dst  =  (Hashtable)bf.Deserialize(ms); 14 

 

转载于:https://www.cnblogs.com/EasonWu/archive/2010/03/09/1681617.html

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)