internal static Attribute[] GetCustomAttributes(RuntimeConstructorInfo ctor, RuntimeType caType, bool includeSecCa, out int count)
{
count = 0;
bool flag = caType == (RuntimeType)typeof(object) || caType == (RuntimeType)typeof(Attribute);
if (!flag && PseudoCustomAttribute.s_pca.GetValueOrDefault(caType) == null && !PseudoCustomAttribute.IsSecurityAttribute(caType))
{
return(new Attribute[0]);
}
List <Attribute> list = new List <Attribute>();
if (includeSecCa && (flag || PseudoCustomAttribute.IsSecurityAttribute(caType)))
{
object[] array;
PseudoCustomAttribute.GetSecurityAttributes(ctor.Module.ModuleHandle.GetRuntimeModule(), ctor.MetadataToken, false, out array);
if (array != null)
{
foreach (object obj in array)
{
if (caType == obj.GetType() || obj.GetType().IsSubclassOf(caType))
{
list.Add((Attribute)obj);
}
}
}
}
count = list.Count;
return(list.ToArray());
}