FirstMatchCodeGroup.Resolve Method (Evidence)
Resolves policy for the code group and its descendants for a set of evidence.
Assembly: mscorlib (in mscorlib.dll)
The evidence for the assembly.
Return ValueType: System.Security.Policy.PolicyStatement
A policy statement consisting of the permissions granted by the code group with optional attributes, or null if the code group does not apply (the membership condition does not match the specified evidence).
Given evidence for an assembly to be loaded, this method evaluates the code group by first checking the membership condition against the specified evidence. If there is a match, this method returns a policy statement for the code group, including evaluation of child code groups.
For first-match code groups, each child code group's membership condition is tested against the evidence in the order in which they were added; only the first match is resolved with the evidence set. If there are no matches, the policy statement of the parent first-match code group applies. The matching child code group type determines how all child groups under it are applied, depending on how the Resolve methods of these child groups work.
The .NET Framework security system uses Resolve on the policy levels to determine which permissions to grant to loaded code from the resulting policy statements and the code request on the assembly.
This operation of this method is as follows:
If the membership condition does not match the specified evidence, return null; otherwise, set the permission set to be returned (P) equal to the code group's policy statement and continue. For each child code group, resolve the code group with the same evidence; if the result is not null, return that policy statement. If no child code group matched, return P (the parent's policy statement).
The following code shows the use of the FirstMatchCodeGroup class.method to resolve policy for the code group. This code example is part of a larger example provided for the
Available since 1.1