日期:2014-05-18 浏览次数:21111 次
/// <summary> /// 得到一个对象的克隆 /// </summary> public static object Clone(object obj) { MemoryStream memoryStream = new MemoryStream(); BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(memoryStream, obj); memoryStream.Position = 0; return formatter.Deserialize(memoryStream); }
------解决方案--------------------
C# code/// <summary>
/// 得到一个对象的克隆
/// </summary>
public static object Clone(object obj)
{
MemoryStream memoryStream = new MemoryStream();
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(memoryStream, obj);
memoryStream.Position = 0;
return formatter.Deserialize(memoryStream);
}
object obj = Clone(ReportTypeIndexDocList );
将obj 转化成Dictionary<String, ReportTypeElement> 类型即可
--reply by CSDN Study V1.0.0.3 (starts_2000)