Document! X
false
Exclude from Online
Exclude from Booklet

#

true

#

7a032303-9805-4638-b34c-69a6db868ffc
10fb8965-c607-4150-be93-4219657192f9
8aaa1a6f-70a8-4a3d-8b69-dc429b86377a
7ceb9cfa-d0df-4c9c-b9df-ab271bccb7f7
6e4dfa3a-41cc-4f4f-933d-acc4ea832f0b
cb91e07d-611c-4efa-84e5-a92187c24b81
Using Compare .NET Objects
5380cb06-997d-4df1-8129-cfa28761d20f
b3f5ba5b-0359-4a92-b95c-8d4e952b3c5f
c669abc0-d388-48b8-ac62-15d9e7b5c797
ebeae5b6-88ec-43e3-a898-92db1bcc4ba0
eb1abafe-c230-45d7-b8dc-7bf3f5c20140
2169f8f6-cac4-40ca-93b2-f02fefe798a9
0d9294fc-870e-4eb0-8d4e-a2fc0feef44f
Reports
0d061814-6a12-4d44-bb74-a2809f19fce6
a6674676-6015-4a01-a478-a0ea8fe0510a
c5780969-16a4-48b1-8dac-34c0292912df
eee6a46b-ecf1-47b6-8a06-6f7e574c06ae
(Un-categorized)

#

<P>This software is provided free of charge from Kellerman Software.<BR>It may be used in any project, including commercial for sale projects.</P> <P>Check out our other great software at <A href="http://www.FSI.Lib.com">www.FSI.Lib.com</A>:<BR>*&nbsp; Free Quick Reference Pack for Developers<BR>*&nbsp; Free Sharp Zip Wrapper<BR>*&nbsp; NUnit Test Generator<BR>* .NET Caching Library<BR>* .NET Email Validation Library<BR>* .NET FTP Library<BR>* .NET Encryption Library<BR>* .NET Logging Library<BR>* Themed Winform Wizard<BR>* Unused Stored Procedures<BR>* AccessDiff<BR>* .NET SFTP Library<BR>* Ninja Database Pro (Object database for .NET, Silverlight, Windows Phone 7)<BR>* Ninja WinRT Database (Object database for Windows 8 Runtime, Windows Phone 8)<BR>* Knight Data Access Layer (ORM, LINQ Provider, Generator)<BR>* CSV Reports (CSV Reader, Writer)<BR>* What's Changed? (Compare words, strings, streams, and text files)<BR>* Excel Reports&nbsp;<BR>* Word Reports</P> <P><BR>Microsoft Public License (Ms-PL)</P> <P>This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software.</P> <P>1. Definitions</P> <P>The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law.</P> <P>A "contribution" is the original software, or any additions or changes to the software.</P> <P>A "contributor" is any person that distributes its contribution under this license.</P> <P>"Licensed patents" are a contributor's patent claims that read directly on its contribution.</P> <P>2. Grant of Rights</P> <P>(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.</P> <P>(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.</P> <P>3. Conditions and Limitations</P> <P>(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.</P> <P>(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.</P> <P>(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.</P> <P>(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.</P> <P>(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.</P>

# What's New?

What's New?
<H1>Breaking Changes</H1> <UL> <LI> <DIV>None </DIV></LI></UL> <P><BR></P> <H1>Bug fixes</H1> <UL> <LI>None</LI></UL> <P><BR></P> <H1>New Features</H1> <UL> <LI>Compare Dynamic Objects <LI>Compare Properties on the root of&nbsp;a custom list</LI></UL> <P>&nbsp;</P>

#

<H1>For Use</H1> <P><BR></P> <UL> <LI>.NET Framework 4.0 and higher <LI>Portable Class Library Version can be used with .NET 4.0+, Silverlight 5+, Windows Phone 8+, Windows RT 8+ <LI>DotNetCore 1.3 or higher<BR></LI></UL> <H1>For Development</H1> <P><BR></P> <UL> <LI>Visual Studio 2013 and higher <LI>NUnit 2.4 and higher</LI></UL> <P><BR></P> <P><BR></P>

#

<H1>Important</H1> <UL> <LI>By default for performance reasons, Compare .NET Objects only detects the first difference.&nbsp; To capture all differences set Config.MaxDifferences to the maximum differences desired. <LI>After the comparison, the differences are in the Differences list or in the DifferencesString properties. <LI>By default, a deep comparison is performed.&nbsp; To perform a shallow comparison, set Config.CompareChildren = false <LI>By default, private and internal properties and fields are not compared.&nbsp; Set ComparePrivateProperties and ComparePrivateFields to true to override this behavior. <LI>By default an exception is thrown when class types are different.&nbsp; To ignore object types, set Config.IgnoreObjectTypes to true</LI></UL> <P>&nbsp;</P> <H1>C# Example</H1> <P>//This is the comparison class<BR>CompareLogic compareLogic = new CompareLogic();</P> <P>//Create a couple objects to compare<BR>Person person1 = new Person();<BR>person1.DateCreated = DateTime.Now;<BR>person1.Name = "Greg";</P> <P>Person person2 = new Person();<BR>person2.Name = "John";<BR>person2.DateCreated = person1.DateCreated;</P> <P>ComparisonResult result = compareLogic.Compare(person1, person2);</P> <P>//These will be different, write out the differences<BR>if (result.AreEqual)<BR>&nbsp;&nbsp;&nbsp; Console.WriteLine(result.Differences);<BR>&nbsp;</P> <H1>VB.NET Example</H1> <P>'This is the comparison class<BR>Dim compareLogic As New CompareLogic()</P> <P>'Create a couple objects to compare<BR>Dim person1 As New Person()<BR>person1.DateCreated = Date.Now<BR>person1.Name = "Greg"</P> <P>Dim person2 As New Person()<BR>person2.Name = "John"<BR>person2.DateCreated = person1.DateCreated</P> <P>Dim result As ComparisonResult = compareLogic.Compare(person1, person2)</P> <P>'These will be different, write out the differences<BR>If result.AreEqual Then<BR>&nbsp;&nbsp;&nbsp; Console.WriteLine(result.Differences)<BR>End If</P> <P><BR></P> <P><BR></P> <P></P> <P><BR></P> <P></P>

#

<A href="http://www.FSI.Lib.com"></A> <DIV class=wikidoc><BR><IMG border=0 alt="" src="images/logo.png"></DIV> <DIV class=wikidoc></DIV> <DIV class=wikidoc><IMG border=0 alt="" src="images/PoweredByNDepend.png"><BR><BR><B>Project Description</B><BR>What you have been waiting for. Perform a deep compare of any two .NET objects using reflection. Shows the differences between the two objects.<BR><BR><B>Compatiblity</B><BR>Compatible with .NET Framework 3.5 and higher. Portable Class Library version works with .NET 4.0+, Silverlight 5+, Windows Phone 8+, Windows RT 8+, Xamarin iOS, and Xamarin Droid.&nbsp; It supports .NET Standard 1.6 and DotNetCore applications too.<BR><BR><B>NuGet Package</B><BR><A href="http://www.nuget.org/packages/CompareNETObjects"><FONT color=#0066cc>http://www.nuget.org/packages/CompareNETObjects</FONT></A><BR><BR>Features </DIV> <DIV class=wikidoc> <UL> <LI>Compare Children (on by default) <LI>Handling for Trees with Children Pointing To Parents <LI>Compare Dynamic Objects <LI>Compare Primitive Types <LI>Compare Structs <LI>Compare IList Objects <LI>Compare Single and Multi-Dimensional Arrays <LI>Compare IDictionary Objects <LI>Compare Publicly visible Class Fields and Properties <LI>Compare Private Fields and Properties (off by default) <LI>Compare Enums <LI>Compare Timespans <LI>Compare Guids <LI>Compare Classes that Implement IList with Indexers <LI>Compare DataSet Data <LI>Compare DataTable Data <LI>Compare DataRow Data <LI>Compare DataColumn Differences <LI>Compare LinearGradient <LI>Compare HashSet <LI>Compare URI <LI>Compare IPEndPoint <LI>Compare Types of Type (RuntimeType) <LI>Source code in C# <LI>NUnit Test Project Included <LI>Ability to load settings from a config file for use with powershell <LI>Several configuration options for comparing private elements, ignoring specific elements, including specific elements. <LI>Property and Field Info reflection caching for increased performance <LI>Rich Differences List or simple DifferencesString <LI>Supports custom comparison functions <LI>ElapsedMilliseconds indicates how long the comparison took <LI>Ability to IgnoreCollectionOrder <LI>Thread Safe <LI>Ability to pass in the configuration <LI>Ability to ignore indexer comparison <LI>Interface member filtering <LI>Ability to treat string.empty and null as equal</LI></UL></DIV>

#

<P>The Compare .NET Objects Library has the ability to do different configurations.&nbsp; </P> <P><BR></P> <H1>Default Configuration</H1> <P><BR></P> <P>CompareLogic logic = new CompareLogic();</P> <P>logic.Config.MaxDifferences = 100;</P> <P><BR></P> <H1>Pass in the Configuration</H1> <P><BR></P> <P>ComparisonConfig config = new ComparisonConfig();</P> <P>config.MaxDifferences = 100;</P> <P><BR></P> <P>CompareLogic logic = new CompareLogic(config);</P> <P><BR></P> <H1>Application Settings Configuration</H1> <P><BR></P> <P>Edit the resource file for the application settings</P> <P><BR></P>

#

<P>By default, the Compare .NET Objects Library will throw an exception if the class types are different.&nbsp; To compare classes that are different types, set Config.IgnoreObjectTypes = true</P> <P><BR></P> <H1>Example</H1> <P><BR></P> <P>RecipeDetail detail1 = new RecipeDetail(true, "Toffee");<BR>detail1.Ingredient = "Crunchy Chocolate";</P> <P>IndianRecipeDetail detail2 = new IndianRecipeDetail(true, "Toffee");<BR>detail2.Ingredient = "Crunchy Chocolate";</P> <P>CompareLogic compareLogic = new CompareLogic();<BR>compareLogic.Config.IgnoreObjectTypes = true;<BR>var result = compareLogic.Compare(detail1, detail2);</P> <P>Assert.IsTrue(result.AreEqual, result.DifferencesString);</P>

#

<P>To add a custom comparer, implement BaseTypeComparer and add to the Config.CustomComparers collection.&nbsp; Custom comparers are run before the built in comparers.&nbsp; </P> <P><BR></P> <H1>Example</H1> <P><BR></P> <P>public class MyCustomComparer : BaseTypeComparer<BR>{<BR>&nbsp;public MyCustomComparer(RootComparer rootComparer) : base(rootComparer)<BR>&nbsp;{<BR>&nbsp;}</P> <P>&nbsp;public override bool IsTypeMatch(Type type1, Type type2)<BR>&nbsp;{<BR>&nbsp;&nbsp;return type1 == typeof (SpecificTenant);<BR>&nbsp;}</P> <P>&nbsp;public override void CompareType(ComparisonResult result, object object1, object object2, string breadCrumb)<BR>&nbsp;{<BR>&nbsp;&nbsp;var st1 = (SpecificTenant)object1;<BR>&nbsp;&nbsp;var st2 = (SpecificTenant)object2;</P> <P>&nbsp;&nbsp;if (st1.Name != st2.Name || st1.Amount &gt; 100 || st2.Amount &lt; 100)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;Difference difference = new Difference<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PropertyName = breadCrumb,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Object1Value = object1.ToString(),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Object2Value = object2.ToString()<BR>&nbsp;&nbsp;&nbsp;&nbsp;};</P> <P>&nbsp;&nbsp;&nbsp;result.Differences.Add(difference);<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>}</P> <P><FONT size=2 face=Consolas><FONT size=2 face=Consolas><BR></FONT></FONT></P> <H1>Usage</H1> <P><BR></P> <P><FONT size=2 face=Consolas>SpecificTenant tenant1 = new SpecificTenant();<BR>tenant1.Name = "wire";<BR>tenant1.Amount = 37;</FONT></P> <P><FONT size=2 face=Consolas>SpecificTenant tenant2 = new SpecificTenant();<BR>tenant2.Name = "wire";<BR>tenant2.Amount = 155;</FONT></P> <P><FONT size=2 face=Consolas>//No Custom Comparer<BR>CompareLogic compareLogic = new CompareLogic();<BR>Assert.IsFalse(compareLogic.Compare(tenant1, tenant2).AreEqual);</FONT></P> <P><FONT size=2 face=Consolas>//specify custom selector<BR>compareLogic.Config.CustomComparers.Add(new MyCustomComparer(RootComparerFactory.GetRootComparer()));</FONT></P> <P><FONT size=2 face=Consolas>Assert.IsTrue(compareLogic.Compare(tenant1, tenant2).AreEqual);</FONT></P> <P><FONT size=2 face=Consolas>tenant2.Amount = 42;<BR>Assert.IsFalse(compareLogic.Compare(tenant1, tenant2).AreEqual);</FONT></P>

#

<P>Beyond Compare Report</P> <P>Compare .NET objects offers the ability to output the results as text files and then launch the third party difference tool Beyond Compare.&nbsp; </P> <P><A href="http://www.scootersoftware.com/index.php">http://www.scootersoftware.com/index.php</A></P> <P>Example</P> <P>[Test]<BR>public void BeyondCompareReportTest()<BR>{<BR>&nbsp;if (File.Exists("beyondExpected.txt"))<BR>&nbsp;&nbsp;File.Delete("beyondExpected.txt");</P> <P>&nbsp;if (File.Exists("beyondActual.txt"))<BR>&nbsp;&nbsp;File.Delete("beyondActual.txt");</P> <P>&nbsp;Movie beyondExpected = new Movie();<BR>&nbsp;beyondExpected.Name = "Oblivion";<BR>&nbsp;beyondExpected.PaymentForTomCruise = 2000000M;</P> <P>&nbsp;Movie beyondActual = new Movie();<BR>&nbsp;beyondActual.Name = "Edge of Tomorrow";<BR>&nbsp;beyondActual.PaymentForTomCruise = 3000000M;</P> <P>&nbsp;CompareLogic compareLogic = new CompareLogic();<BR>&nbsp;compareLogic.Config.MaxDifferences = Int32.MaxValue;<BR>&nbsp;ComparisonResult result = compareLogic.Compare(beyondExpected, beyondActual);</P> <P>&nbsp;BeyondCompareReport beyondCompare = new BeyondCompareReport();<BR>&nbsp;beyondCompare.OutputFiles(result.Differences, "beyondExpected.txt", "beyondActual.txt");</P> <P>&nbsp;Assert.IsTrue(File.Exists("beyondExpected.txt"));<BR>&nbsp;Assert.IsTrue(File.Exists("beyondActual.txt"));</P> <P>&nbsp;beyondCompare.LaunchApplication("beyondExpected.txt", "beyondActual.txt");<BR>}</P>

#

<P>WinMerge Report </P> <P>Compare .NET objects offers the ability to output the results as text files and then launch the third party difference tool WinMerge. </P> <P><A href="http://winmerge.org/">http://winmerge.org/</A></P> <P>Example</P> <P>[Test]<BR>public void WinMergeReportTest()<BR>{<BR>&nbsp;if (File.Exists("winMergeExpected.txt"))<BR>&nbsp;&nbsp;File.Delete("winMergeExpected.txt");</P> <P>&nbsp;if (File.Exists("winMergeActual.txt"))<BR>&nbsp;&nbsp;File.Delete("winMergeActual.txt");</P> <P>&nbsp;Movie winMergeExpected = new Movie();<BR>&nbsp;winMergeExpected.Name = "Oblivion";<BR>&nbsp;winMergeExpected.PaymentForTomCruise = 2000000M;</P> <P>&nbsp;Movie winMergeActual = new Movie();<BR>&nbsp;winMergeActual.Name = "Edge of Tomorrow";<BR>&nbsp;winMergeActual.PaymentForTomCruise = 3000000M;</P> <P>&nbsp;CompareLogic compareLogic = new CompareLogic();<BR>&nbsp;compareLogic.Config.MaxDifferences = Int32.MaxValue;<BR>&nbsp;ComparisonResult result = compareLogic.Compare(winMergeExpected, winMergeActual);</P> <P>&nbsp;WinMergeReport winMergeReport = new WinMergeReport();<BR>&nbsp;winMergeReport.OutputFiles(result.Differences, "winMergeExpected.txt", "winMergeActual.txt");</P> <P>&nbsp;Assert.IsTrue(File.Exists("winMergeExpected.txt"));<BR>&nbsp;Assert.IsTrue(File.Exists("winMergeActual.txt"));</P> <P>&nbsp;winMergeReport.LaunchApplication("winMergeExpected.txt", "winMergeActual.txt");<BR>}</P>

#

<P>CSV Report</P> <P>The CSV Reports outputs the results to a comma separated value file.&nbsp; The launch portion will open the file using whatever application is associated with the .csv extension.&nbsp; Normally this is Excel.</P> <P>Example</P> <P>[Test]<BR>public void CsvReportTest()<BR>{<BR>&nbsp;if (File.Exists("movie.csv"))<BR>&nbsp;&nbsp;File.Delete("movie.csv");</P> <P>&nbsp;Movie movie1 = new Movie();<BR>&nbsp;movie1.Name = "Oblivion";<BR>&nbsp;movie1.PaymentForTomCruise = 2000000M;</P> <P>&nbsp;Movie movie2 = new Movie();<BR>&nbsp;movie2.Name = "Edge of Tomorrow";<BR>&nbsp;movie2.PaymentForTomCruise = 3000000M;</P> <P>&nbsp;CompareLogic compareLogic = new CompareLogic();<BR>&nbsp;compareLogic.Config.MaxDifferences = Int32.MaxValue;<BR>&nbsp;ComparisonResult result = compareLogic.Compare(movie1, movie2);</P> <P>&nbsp;CsvReport csvReport = new CsvReport();<BR>&nbsp;csvReport.OutputFile(result.Differences, "movie.csv");</P> <P>&nbsp;Assert.IsTrue(File.Exists("movie.csv"));</P> <P>&nbsp;csvReport.LaunchApplication("movie.csv");<BR>}</P>

#

<P>Sometimes you want to show the differences of an object to a user before they submit their changes to the database.&nbsp; The User Friendly report can be used to do this:</P> <P>Example</P> <P>[Test]<BR>public void UserFriendlyReportTest()<BR>{<BR>&nbsp;if (File.Exists("movie.txt"))<BR>&nbsp;&nbsp;File.Delete("movie.txt");</P> <P>&nbsp;Movie movie1 = new Movie();<BR>&nbsp;movie1.Name = "Oblivion";<BR>&nbsp;movie1.PaymentForTomCruise = 2000000M;</P> <P>&nbsp;Movie movie2 = new Movie();<BR>&nbsp;movie2.Name = "Edge of Tomorrow";<BR>&nbsp;movie2.PaymentForTomCruise = 3000000M;</P> <P>&nbsp;CompareLogic compareLogic = new CompareLogic();<BR>&nbsp;compareLogic.Config.MaxDifferences = Int32.MaxValue;<BR>&nbsp;ComparisonResult result = compareLogic.Compare(movie1, movie2);</P> <P>&nbsp;UserFriendlyReport friendlyReport = new UserFriendlyReport();<BR>&nbsp;friendlyReport.OutputFile(result.Differences, "movie.txt");</P> <P>&nbsp;Assert.IsTrue(File.Exists("movie.txt"));</P> <P>&nbsp;Console.WriteLine(friendlyReport.OutputString(result.Differences));</P> <P>&nbsp;friendlyReport.LaunchApplication("movie.txt");<BR>}</P>

#

<P>Ignoring the Order</P> <P>Sometimes lists, arrays, and dictionaries are equal to each other but they are in a different order.&nbsp; The Config.IgnoreCollectionOrder property can be used to compare lists that are not only out of order but also of different lengths.&nbsp; There is a huge performance decrease when Ignoring the Collection Order.&nbsp; This may be okay if you are comparing a few hundred&nbsp; objects at a time.&nbsp; By default all the simple type properties are used as a key for an object.&nbsp; To minimize the perforance impact, define a Config.CollectionMatchingSpec.&nbsp; This defines the key for the object.&nbsp; </P> <P><STRONG>Example:</STRONG></P> <P>CompareLogic logic = new CompareLogic();<BR>logic.Config.IgnoreCollectionOrder = true;</P> <P>var spec = new Dictionary&lt;Type, IEnumerable&lt;string&gt;&gt;();<BR>spec.Add(typeof(Customer), new string[] { "CustomerId" });<BR>logic.Config.CollectionMatchingSpec = spec;</P>

#

<P>&nbsp;</P> <P>Q:&nbsp; I would like to report a defect.&nbsp; I have an object with many differences and it is only reporting one difference.<BR>A:&nbsp; By default for performance reasons, Compare .NET Objects only detects the first difference.&nbsp; To capture all differences set Config.MaxDifferences to the maximum differences desired. </P> <P>Q:&nbsp; I want to show all the differences in my list of objects.&nbsp; If the lists are different counts, it doesn't compare everything.&nbsp; How can I compare it?<BR>A:&nbsp; Set Config.MaxDifferences to the maximum difference desired.&nbsp; Set Config.IgnoreCollectionOrder to true.&nbsp; If you have a primary key for the class, make sure to define a Config.CollectionMatchingSpec.</P> <P>Q:&nbsp; What if I don't want to compare everything?<BR>A:&nbsp; Add the names of class types to the Config.ClassTypesToIgnore or add the names of members to the Config.MembersToIgnore.&nbsp; If you need something more complex, you can always implement your own custom comparer.&nbsp; See Custom Comparers.</P> <P>Q:&nbsp; What can I use this thing for?<BR>A:&nbsp; See the Uses topic.</P>

#

<P>How are lists, arrays, dictionaries compared?</P> <P>Lists of items are compared by looping through the enumerators.&nbsp; For performance reasons, it is assumed that the lists are in the same order.&nbsp; If the counts are different the comparison will exit as soon as it reaches the end of one of the lists.&nbsp; To compare all items in the list, ignore the order.&nbsp; See Ignoring Order for more information.</P>

#

<P>What can I use this thing for?</P> <P>Verify ORM Mappings<BR>Get a list of changes and log it to the database<BR>Determine if an object is dirty<BR>Verify all the data is being saved to the database by doing a save and then load.<BR>Verify end to end translation for services.</P>

#

<FONT size=2 face=Consolas><FONT size=2 face=Consolas> <P>[</FONT></FONT><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas>Test</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>]</P> <P></FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>public</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> </FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>void</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> IgnoreTypeMember()</P> <P>{</P> <P></FONT></FONT><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas>ComparisonConfig</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> config = </FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>new</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> </FONT></FONT><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas>ComparisonConfig</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>();</P> <P>config.MembersToIgnore.Add(</FONT></FONT><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas>"Person.Name"</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>);</P> <P></FONT></FONT><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas>Person</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> person1 = </FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>new</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> </FONT></FONT><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas>Person</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>() {Name=</FONT></FONT><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas>"Darth Vader"</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>};</P> <P></FONT></FONT><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas>Person</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> person2 = </FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>new</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> </FONT></FONT><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas>Person</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>() { Name = </FONT></FONT><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas>"Anakin Skywalker"</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> };</P> <P></FONT></FONT><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas>CompareLogic</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> compare = </FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>new</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> </FONT></FONT><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas>CompareLogic</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>(config);</P> <P></FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>var</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> result = compare.Compare(person1,person2);</P> <P></FONT></FONT><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas>Assert</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>.IsTrue(result.AreEqual);</P> <P>}</P></FONT></FONT>
0
0
false
false
0
Introduction
false
true
.html

# Compare .NET Objects

false
true
&copy; Kellerman Software %%year%% All Rights Reserved.
<a href="mailto:support@FSI.Lib.com?subject=Documentation Feedback: %%FileName%%">Send Feedback</a>
&copy; Kellerman Software %%year%%. All Rights Reserved.
<a href="mailto:support@FSI.Lib.com?subject=Documentation Feedback: %%FileName%%">Send Feedback</a>
false
PublicEvaluation
false
true
true
false
System.*
true
false
true
false
false
false
true
false
false
false
false
false
true
false
false
false
false
true
true
Exclude
false
Merge
false
#FFFF0000
10
false
0.3
3
#FF000000
300
All
false
false
false
true
false
ArgumentsInBrackets
false
Visual Studio 2008 Style
true
true
false
false
TemplateDefault
true
false
false
false
false
false
false
false
Delphi
JScript
CPP2005
true
true
true
false
true
false
60
true
true
true
true
false
true
false
false
Merge
true
#FFFF0000
10
false
0.3
3
#FF000000
300
All
false
false
false
Classic
true
true
false
false
false
false
true
false
true
true
true
false
true
false
false
Merge
false
#FFFF0000
10
false
0.3
3
#FF000000
300
All
false
false
false
Visual Studio 2008 Style
true
true
false
false
true
false
false
true
true
true
false
false
Merge
true
#FFFF0000
10
false
0.3
3
#FF000000
300
All
false
true
false
Visual Studio 2008 Style
true
true
false
false
Visual Studio 2008 Style
false
true
true
true
true
true
true
true
true
true
false
Merge
true
5
false
true
false
5
true
false
3
3
true
false
Visual Studio 2008 Style
true
Merge
true
true
true
true
true
true
true
true
true
true
false
true
true
Classic
true
Merge
true
(0014)about:internet
HtmlHelp1
default
2010Style
false
false
VS
100
en-US
true
true
false
false
false
Default
false
true
true
true
false
false
false
true
true
true
false
false
false
200
false
true
true
false
true
Contents
true
400
600
0
0
false
..\..\Compare-NET-Objects-Help\Compare-NET-Objects-Help.chm
{46CEF21D-3301-4517-A875-A0906828390E}
Visual Studio 2008 Style
true
true
true
false
CreationDateTime
false
false
5
H1
$$In_This_Topic$$
false
false
false
build\Compare .NET Objects Help
false