Forces a System.Security.SecurityException at run time if all callers higher in the call stack have not been granted the permissions specified by the current instance.
Type Reason System.Security.SecurityException A caller does not have the permission specified by the current instance.
Use PermissionSet.Demand on a System.Security.PermissionSet to ensure that all callers have all permissions in the set with one operation.
The permissions of the code that calls this method are not examined; the check begins from the immediate caller of that code and proceeds up the stack. The call stack is typically represented as growing down, so that methods higher in the call stack call methods lower in the call stack. PermissionSet.Demand succeeds only if no System.Security.SecurityException is thrown.
If the System.Security.PermissionSet contains permissions that do not inherit from System.Security.CodeAccessPermission, the Demand methods of those permissions are called as well.