protected static bool HasSecurityAttribute (ICustomAttributeProvider provider, AttributeType type)
{
if (!provider.HasCustomAttributes)
return false;
foreach (CustomAttribute attribute in provider.CustomAttributes) {
switch (attribute.Constructor.DeclaringType.Name) {
case _critical:
if (type == AttributeType.Critical)
return true;
break;
case _safe_critical:
if (type == AttributeType.SafeCritical)
return true;
break;
}
}
return false;
}