我有以下代码似乎没有正确行事.有一个属性有一个属性不是类型FieldMapAttribute,但它仍然进入if条件,我检查匹配该类型属性的计数.
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;
}
}
Run Code Online (Sandbox Code Playgroud)
有人可以帮我理解这里发生了什么吗?