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

推荐订阅源

F
Fortinet All Blogs
Attack and Defense Labs
Attack and Defense Labs
V2EX - 技术
V2EX - 技术
O
OpenAI News
S
Secure Thoughts
H
Heimdal Security Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Schneier on Security
Schneier on Security
H
Hacker News: Front Page
S
Security Affairs
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
The Register - Security
The Register - Security
GbyAI
GbyAI
Cloudbric
Cloudbric
MongoDB | Blog
MongoDB | Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
K
Kaspersky official blog
Forbes - Security
Forbes - Security
Y
Y Combinator Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
Scott Helme
Scott Helme
Hacker News - Newest:
Hacker News - Newest: "LLM"
The Cloudflare Blog
Recorded Future
Recorded Future
人人都是产品经理
人人都是产品经理
Cyberwarzone
Cyberwarzone
C
CERT Recently Published Vulnerability Notes
Webroot Blog
Webroot Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LangChain Blog
T
Tor Project blog
Microsoft Azure Blog
Microsoft Azure Blog
博客园_首页
Hacker News: Ask HN
Hacker News: Ask HN
Blog — PlanetScale
Blog — PlanetScale
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog RSS Feed
N
News and Events Feed by Topic
阮一峰的网络日志
阮一峰的网络日志
I
Intezer
V
V2EX
T
Tailwind CSS Blog
SecWiki News
SecWiki News
NISL@THU
NISL@THU
C
Check Point Blog

博客园 - 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)  评论()    收藏  举报