Weird result comparing property values using reflection

Posted by Brian on Stack Overflow See other posts from Stack Overflow or by Brian
Published on 2009-09-16T20:42:10Z Indexed on 2010/05/27 0:21 UTC
Read the original article Hit count: 503

Filed under:
|

Can someone explain why this is occurring? The code below was executed in the immediate window in vs2008. The prop is an Int32 property (id column) on an object created by the entity framework.

The objects entity and defaultEntity were created using Activator.CreateInstance();

Convert.ChangeType(prop.GetValue(entity, null), prop.PropertyType) 0 Convert.ChangeType(prop.GetValue(defaultEntity, null), prop.PropertyType) 0 Convert.ChangeType(prop.GetValue(entity, null), prop.PropertyType) == Convert.ChangeType(prop.GetValue(defaultEntity, null), prop.PropertyType) false

© Stack Overflow or respective owner

Related posts about comparison

Related posts about property