I have the following piece of code which doesn't seem to be acting right. There is a property which has one attribute which is not of type FieldMapAttribute
, but still it goes into the if condition where I am checking the count matching that type of attribute.
foreach (PropertyInfo _property in _properties)
{
var attributes = _property.GetCustomAttributes(false);
if (attributes.Select(a => a.GetType() == typeof(FieldMapAttribute)).Count() > 0)
{
colname = (attributes.Select(a => a.GetType() == typeof(FieldMapAttribute)).Cast<FieldMapAttribute>().First()).DbColumnName;
}
}
Can someone help me to understand what is going on here?