Compare objects in VB.NET

I want to write a function that accepts two objects as parameters and compare only the fields contained within the objects. I do not know what type the objects will be at design time, but the objects passed will be classes used within our application.

Is it possible to compare object's fields without knowing their types at runtime?


Yes, it is possible to find the fields, properties, and methods of objects at runtime. You will need to use System.Reflection and find the matching fields, make sure the datatypes are compatible, and then compare the values.

Need Your Help

Custom SQL Server performance counters

sql-server sql-server-2008 monitoring performancecounter perfmon

I need to create several counters for a system health check and monitoring. Since there are numerous tools for logging, reporting and alerting Windows Perfmon data, I am looking to publish that dat...

Why UsbAccessory class is added in API Level 12 not from API level 8?

java android api usb file-transfer

I think most of the world today uses API level 8 and most of the programmers Developes application for API level 8, then why USB functionality not given here is it something special about this?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.