StrongNameIdentityPermission::IsSubsetOf Method (IPermission^)
Determines whether the current permission is a subset of the specified permission.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- target
-
Type:
System.Security::IPermission^
A permission that is to be tested for the subset relationship. This permission must be of the same type as the current permission.
Return Value
Type: System::Booleantrue if the current permission is a subset of the specified permission; otherwise, false.
Implements
IPermission::IsSubsetOf(IPermission^)| Exception | Condition |
|---|---|
| ArgumentException | The target parameter is not null and is not of the same type as the current permission. |
The current permission is a subset of the specified permission if the current permission specifies a set of operations that is wholly contained by the specified permission. For example, the other properties being equal, an identity with the Name property containing the wildcard expression MyCompany.MyDepartment.* is identified as a subset of an identity with the Name property MyCompany.MyDepartment.MyFile.
The following code example shows the results of the use of the IsSubsetOf method, not how to use the method. This example is part of a larger example provided for the StrongNameIdentityPermission class. The best use for this example is to build and execute the entire example, and view its output.
Note |
|---|
The code example is intended to show the behavior of the method, not to demonstrate its use. In general, the methods of permission classes are used by the security infrastructure; they are not typically used in applications. |
// IsSubsetOf determines whether the current permission is a subset of the specified permission. bool IsSubsetOfDemo() { bool returnValue = true; StrongNameIdentityPermission^ snIdPerm1; StrongNameIdentityPermission^ snIdPerm2; snIdPerm1 = gcnew StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.*", gcnew Version("1.0.0.0")); snIdPerm2 = gcnew StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.MyFile", gcnew Version("1.0.0.0")); if (snIdPerm1->IsSubsetOf(snIdPerm2)) { Console::WriteLine("MyCompany.MyDepartment.* is a subset " + "of MyCompany.MyDepartment.MyFile \n"); } else { Console::WriteLine("MyCompany.MyDepartment.*" + " is not a subset of MyCompany.MyDepartment.MyFile \n"); } return returnValue; }
Available since 1.1
