基本信息
源码名称:对象比较集合对比的类库
源码大小:0.81M
文件格式:.rar
开发语言:C#
更新时间:2018-11-06
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 3 元×
微信扫码支付:3 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
对象比较,集合元素比较的类库
using System; using System.Collections.Generic; using System.Linq; using System.Text; using CompareObjectsNet; namespace CompareNetObjDemo { class Program { static void Main(string[] args) { Test1(); Console.WriteLine("完成"); Console.ReadKey(); } static void Test1() { //创建比较对象的类型 CompareLogic compareLogic = new CompareLogic(); //创建2个不同的Person类型 Person person1 = new Person(); person1.DateCreated = DateTime.Now; person1.Name = "Jorn"; person1.Age = 25; Person person2 = new Person(); person2.Name = "Greg"; person2.DateCreated = DateTime.Now; person2.Age = 22; //设置比较对象的配置文件,最大不同点为3 compareLogic.Config.MaxDifferences = 2; //获取比较结果,使用Compare方法 ComparisonResult result = compareLogic.Compare(person1, person2); //如果不相等,输出不同信息字符串 if (!result.AreEqual) Console.WriteLine(result.DifferencesString); } } public class Person { public String Name { get; set; } public Int32 Age { get; set; } public DateTime DateCreated { get; set; } } }