System.Security.FrameSecurityDescriptor.CheckSetDemand C# (CSharp) Method

CheckSetDemand() private method

private CheckSetDemand ( PermissionSet demandSet, PermissionSet &alteredDemandSet, RuntimeMethodHandle rmh ) : bool
demandSet PermissionSet
alteredDemandSet PermissionSet
rmh System.RuntimeMethodHandle
return bool
        internal bool CheckSetDemand(PermissionSet demandSet,
                                                                   out PermissionSet alteredDemandSet,
                                                                   RuntimeMethodHandle rmh)
        {
            // imperative security
            PermissionSet altPset1 = null, altPset2 = null;
            bool fContinue = CheckSetDemand2(demandSet, out altPset1, rmh, false); 
            if (altPset1 != null)
            {
                demandSet = altPset1;
            }
                
            if (fContinue == SecurityRuntime.StackContinue)
            {
                // declarative security
                fContinue = CheckSetDemand2(demandSet, out altPset2, rmh, true);
            }
            // Return the most recent altered set
            // If both declarative and imperative asserts modified the demand set: return altPset2
            // Else if imperative asserts modified the demand set: return altPset1
            // else no alteration: return null
            if (altPset2 != null)
                alteredDemandSet = altPset2;
            else if (altPset1 != null)
                alteredDemandSet = altPset1;
            else
                alteredDemandSet = null;                
            
            return fContinue;
        }
        

Usage Example

 [System.Security.SecurityCritical]  // auto-generated
 private static bool FrameDescSetHelper(FrameSecurityDescriptor secDesc,
                                        PermissionSet demandSet,
                                        out PermissionSet alteredDemandSet,
                                        RuntimeMethodHandleInternal rmh)
 {
     return secDesc.CheckSetDemand(demandSet, out alteredDemandSet, rmh);
 }
All Usage Examples Of System.Security.FrameSecurityDescriptor::CheckSetDemand