System.Security.CodeAccessSecurityEngine.SpecialDemand C# (CSharp) Method

SpecialDemand() private method

private SpecialDemand ( PermissionType whatPermission, System.Threading.StackCrawlMark &stackMark ) : void
whatPermission PermissionType
stackMark System.Threading.StackCrawlMark
return void
        internal static extern void SpecialDemand(PermissionType whatPermission, ref StackCrawlMark stackMark);
        [MethodImplAttribute(MethodImplOptions.InternalCall)]

Usage Example

Example #1
0
        [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
        internal static void Demand(PermissionType permissionType)
        {
            //    The intent of the method is to be an internal mscorlib helper that Demands a specific permissiontype
            //    without having to create objects.
            //    The security annotation fxcop rule that flags all methods with a Demand() has logic
            //    which checks for methods named Demand in types that implement IPermission or IStackWalk.
            Debug.Assert(new StackFrame().GetMethod().Name.Equals("Demand"), "This method needs to be named Demand");

            StackCrawlMark stackMark = StackCrawlMark.LookForMyCallersCaller;

            CodeAccessSecurityEngine.SpecialDemand(permissionType, ref stackMark);
        }
All Usage Examples Of System.Security.CodeAccessSecurityEngine::SpecialDemand