惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
Stack Overflow Blog
Stack Overflow Blog
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
T
The Blog of Author Tim Ferriss
博客园 - 叶小钗
N
Netflix TechBlog - Medium
腾讯CDC
C
Check Point Blog
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
S
SegmentFault 最新的问题
F
Fortinet All Blogs
美团技术团队
U
Unit 42
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 司徒正美
F
Full Disclosure
Recorded Future
Recorded Future
D
DataBreaches.Net
博客园 - 【当耐特】
Martin Fowler
Martin Fowler
J
Java Code Geeks
I
InfoQ
Y
Y Combinator Blog
A
About on SuperTechFans
AI
AI
爱范儿
爱范儿
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Forbes - Security
Forbes - Security
W
WeLiveSecurity
M
MIT News - Artificial intelligence
雷峰网
雷峰网
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
Schneier on Security
Schneier on Security
The GitHub Blog
The GitHub Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
aimingoo的专栏
aimingoo的专栏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
G
GRAHAM CLULEY
Know Your Adversary
Know Your Adversary
Latest news
Latest news
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
D
Docker
Recent Commits to openclaw:main
Recent Commits to openclaw:main
量子位
V2EX - 技术
V2EX - 技术
Project Zero
Project Zero

博客园 - ronphy

复杂型数据“动态规则”校验的设计与实现 UltraNumTextBox【实现所有数字输入的同时,可以控制当控件禁用时ForeColor】 关于 double类型乘以100精度丢失的奇怪问题? 安装中文VS2008 SP1 后智能提示是英文的解决办法(官方解决办法) NET牛人应该知道些什么 软件: Netscape正式死亡 软件: WorldWide Telescope即将发布 编程艺术——13个惊人的Code Demo 互联网: 谷歌连续第二年成为最适合工作的公司 微软将在2月12日把浏览器强制升级到IE7 微软公开.NET Base Classes源代码 IT: 蓝牙十岁了 IT2008预言:哪些可能发生,哪些不会 2008年十大个人技术趋势 联想IdeaPad品牌出炉 三款笔记本亮相 [今日推荐]昨天看到的有趣的消息. [共享一下]Head.First.设计模式.中文版 [推荐]2008年必不可少的20个网络产品 最好的免费web游戏
DTO的深度克隆实现
ronphy · 2012-04-12 · via 博客园 - ronphy
 

/// <summary>
        
/// 克隆方法
        
/// </summary>
        
/// <returns></returns>
        public object Clone()
        {
            try
            {

                Type type = this.GetType();

                VoucherDTO vd = (VoucherDTO)Activator.CreateInstance(type);

                PropertyInfo[] pilist = type.GetProperties();

                foreach (PropertyInfo item in pilist)
                {
                    PropertyInfo pi = this.GetType().GetProperty(item.Name);

                    if (pi != null)
                    {
                        object value = pi.GetValue(thisnull);

                        item.SetValue(vd, value, null);
                    }
                }

                vd.Details = new List<VoucherDTO>();

                return vd;
            }
            catch (Exception ex)
            {
                throw new Exception("克隆方法出现异常!", ex);

            }
        }

posted @ 2012-04-12 10:17  ronphy  阅读(1019)  评论()    收藏  举报