Export (0) Print
Expand All

StrongNameIdentityPermission.IsSubsetOf Method

Determines whether the current permission is a subset of the specified permission.

Namespace: System.Security.Permissions
Assembly: mscorlib (in mscorlib.dll)

public override bool IsSubsetOf (
	IPermission target
)
public boolean IsSubsetOf (
	IPermission target
)
public override function IsSubsetOf (
	target : IPermission
) : boolean

Parameters

target

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

true if the current permission is a subset of the specified permission; otherwise, false.

Exception typeCondition

ArgumentException

The target parameter is not a null reference (Nothing in Visual Basic) 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.

// IsSubsetOf determines whether the current permission is a subset of the specified permission.
private bool IsSubsetOfDemo()
{

    bool returnValue = true;

    StrongNameIdentityPermission snIdPerm1, snIdPerm2;

    snIdPerm1 = new StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.*", new Version("1.0.0.0"));
    snIdPerm2 = new StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.MyFile", new 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;
}

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2015 Microsoft