Skip to content

Instantly share code, notes, and snippets.

View huseyint's full-sized avatar

Hüseyin Tüfekçilerli huseyint

View GitHub Profile
@huseyint
huseyint / comaprison.cs
Created June 15, 2011 06:41 — forked from jakcharlton/comaprison.cs
Property equality comparison on two objects
// Shamelessly stolen and adapted from http://stackoverflow.com/questions/506096/comparing-object-properties-in-c
public static class Comparisons
{
public static bool PublicInstancePropertiesEqual<T>(this T self, T to, params string[] ignore) where T : class
{
if (self != null && to != null)
{
var type = typeof(T);
foreach (var propertyName in type.GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance).Select(pi => pi.Name).Except(ignore))
{