Nettiers.AdventureWorks.Entities.EntityUtil.IsPropertyValueEqual C# (CSharp) Method

IsPropertyValueEqual() public static method

Determines if the property with the specified name equals the specified value.
public static IsPropertyValueEqual ( Object item, String propertyName, Object propertyValue ) : bool
item Object An object instance.
propertyName String The property name.
propertyValue Object The property value.
return bool
		public static bool IsPropertyValueEqual(Object item, String propertyName, Object propertyValue)
		{
			PropertyInfo property = null;
			Object prevValue = GetPropertyValue(item, propertyName, out property);

			Object currValue = null;
			bool isEqual = false;

			if ( property != null )
			{
				currValue = ChangeType(propertyValue, property.PropertyType);
				isEqual = Object.Equals(prevValue, currValue);
			}

			return isEqual;
		}