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

推荐订阅源

B
Blog RSS Feed
V2EX - 技术
V2EX - 技术
P
Privacy & Cybersecurity Law Blog
T
The Exploit Database - CXSecurity.com
美团技术团队
WordPress大学
WordPress大学
博客园 - 司徒正美
S
Securelist
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - Franky
Attack and Defense Labs
Attack and Defense Labs
Security Latest
Security Latest
L
LINUX DO - 最新话题
NISL@THU
NISL@THU
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
腾讯CDC
Y
Y Combinator Blog
The Hacker News
The Hacker News
Security Archives - TechRepublic
Security Archives - TechRepublic
IT之家
IT之家
T
Threatpost
Hugging Face - Blog
Hugging Face - Blog
Scott Helme
Scott Helme
S
SegmentFault 最新的问题
Cyberwarzone
Cyberwarzone
C
Cisco Blogs
阮一峰的网络日志
阮一峰的网络日志
U
Unit 42
B
Blog
Microsoft Azure Blog
Microsoft Azure Blog
P
Proofpoint News Feed
小众软件
小众软件
V
Vulnerabilities – Threatpost
J
Java Code Geeks
V
Visual Studio Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
A
Arctic Wolf
博客园 - 【当耐特】
Microsoft Security Blog
Microsoft Security Blog
S
Security @ Cisco Blogs
雷峰网
雷峰网
Help Net Security
Help Net Security
The Last Watchdog
The Last Watchdog
Recent Announcements
Recent Announcements
G
Google Developers Blog
C
CERT Recently Published Vulnerability Notes
T
Troy Hunt's Blog
MyScale Blog
MyScale Blog

博客园 - Edison.Feng

Objective-读Xml [转]iPhone Mapkit 之在地图加入坐标点 使用MKAnnotation和MKAnnotationView [转]Android:使用URL和URLConnection(多线程下载) 【转】httpModules 与 httpHandlers 【转】挣脱浏览器的束缚(2) - 别让脚本引入坏了事 [转]asp.net中利用ashx实现图片防盗链 求任何一个正数的组合,组合的规则是这个数等于1或2的整数幂之和,请列出组合的情况。 C#利用反射获取对象属性值 Clone:Xml序列化反序列克隆对象 [转]Linux slab 分配器剖析 [转]Linux对I/O端口资源的管理 [转]linux内核分析-初始化分析 start_kernel paging_init [转]Linux TCP/IP 协议栈的关键数据结构Socket Buffer(sk_buff ) [转]Linux系统内核接收以太帧的处理程序 母牛生小牛(递归) MS SQL:Funcation拆分行 我使用WebService:Function.asmx的惊叹!!!
C#利用反射获取对象属性的修改情况
Edison.Feng · 2010-05-12 · via 博客园 - Edison.Feng

 public static string GetObjectUpdateInfo<T>(T old, T current)
        {
            string info = string.Empty;

            Type type = typeof(T);

            PropertyInfo[] propertys = type.GetProperties();

            foreach (PropertyInfo property in propertys)
            {
                if (property.PropertyType.IsValueType || property.PropertyType.Name == "String")
                {
                    if (property.PropertyType.FullName.Contains("Guid")) continue;

                    object o1 = property.GetValue(old, null);
                    object o2 = property.GetValue(current, null);
                    string str1 = o1 == null ? string.Empty : o1.ToString();
                    string str2 = o2 == null ? string.Empty : o2.ToString();

                    if (str1 != str2) info += property.Name + " from " + str1 + " to " + str2 + "\r\n    ";
                }
            }

            return info;
        }