public static bool ArePropertiesEqual(PropertyInfo property, object object1, object object2)
{
bool result = true;
object object1Value = null;
object object2Value = null;
if (object1 != null)
{
object1Value = property.GetValue(object1, null);
}
if (object2 != null)
{
object2Value = property.GetValue(object2, null);
}
if (object1Value != null)
{
if (object1Value.Equals(object2Value) == false)
{
result = false;
}
}
else
{
if (object2Value != null)
{
result = false;
}
}
return result;
}