Dictionary如何对其深度拷贝 一个对象中有若干Dictionary,除了序列化反序列化此对象,有没有其它方法可以使包含Dictionary的对象深度拷贝,或者实现Dictionary的clone?因为查了下网上说序列化反序列化好像消耗比较大,而我的对象正好是属于那种属性比较多,且不停的使用的,要经常深度拷贝 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 比如这样一个字典key类型为int, value类型为一个自定义的类,此类我已经实现clone,此时含此字典的父类该如何写深拷贝呢? Dictionary<int, objcet> dicdest = new Dictionary<int, object>();foreach(int index in dic.Keys){object obj = dic[index].Clone();dicdest.Add(index, obj);} IDictionary<string, object> attributes = new Dictionary<string, object>();IDictionary<string, object> attributes1 = new Dictionary<string, object>(); if (attributes != null) foreach (KeyValuePair<string, object> kvp in attributes) { attributesSelectItems0.Add(kvp); } 截取字符长度 问题 关于调用 AJAX.dll 的问题? bcp导入数据前一定要先建表吗?加数据文件不建表行吗 .net 缓存问题 如何让网页接受winform上的传递的参数 问一个超简单的问题? 手机软件开发 拖动窗体控件 在C#中可以使用参数的预设值吗? 那有coolbar这个控件下载呀!我真的想把菜单做漂亮点...... StartIndex 不能小于 0 求一个匹配url且不包含一个指定url的正则
foreach(int index in dic.Keys)
{
object obj = dic[index].Clone();
dicdest.Add(index, obj);
}
IDictionary<string, object> attributes1 = new Dictionary<string, object>();
if (attributes != null)
foreach (KeyValuePair<string, object> kvp in attributes)
{
attributesSelectItems0.Add(kvp);
}