private MethodBase CheckMethodSecurity (MethodBase mb)
{
#if NET_2_1
return mb;
#else
if (!SecurityManager.SecurityEnabled || (mb == null))
return mb;
// Sadly we have no way to know which kind of security action this is
// so we must do it the hard way. Actually this isn't so bad
// because we can skip the (mb.Attributes & MethodAttributes.HasSecurity)
// icall required (and do it ourselves)
// this (unlike the Invoke step) is _and stays_ a LinkDemand (caller)
return SecurityManager.ReflectedLinkDemandQuery (mb) ? mb : null;
#endif
}