Export (0) Print
Expand All

PermissionSet.IsSubsetOf Method

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

[Visual Basic]
Public Overridable Function IsSubsetOf( _
   ByVal target As PermissionSet _
) As Boolean
[C#]
public virtual bool IsSubsetOf(
 PermissionSet target
);
[C++]
public: virtual bool IsSubsetOf(
 PermissionSet* target
);
[JScript]
public function IsSubsetOf(
   target : PermissionSet
) : Boolean;

Parameters

target
A PermissionSet to test for the subset relationship. This must be either a PermissionSet or a NamedPermissionSet.

Return Value

true if the current PermissionSet is a subset of the target parameter; otherwise, false.

Remarks

A PermissionSet is a subset of the target PermissionSet if all demands that succeed for the PermissionSet also succeed for the target. That is, the target contains at least the permissions contained in the subset.

Example

[Visual Basic] 
' Create a second permission set and compare it to the first permission set.
ps2.AddPermission(New EnvironmentPermission(EnvironmentPermissionAccess.Read, "USERNAME"))
ps2.AddPermission(New EnvironmentPermission(EnvironmentPermissionAccess.Write, "COMPUTERNAME"))
Console.WriteLine("Second permission IsSubsetOf first permission = " & ps2.IsSubsetOf(ps1))

[C#] 
// Create a second permission set and compare it to the first permission set.
ps2.AddPermission(
    new EnvironmentPermission(EnvironmentPermissionAccess.Read, "USERNAME"));
ps2.AddPermission(
    new EnvironmentPermission(EnvironmentPermissionAccess.Write, "COMPUTERNAME"));
Console.WriteLine("Second permission IsSubsetOf first permission = " + ps2.IsSubsetOf(ps1));

[C++] 
// Create a second permission set and compare it to the first permission set.
ps2->AddPermission(
   new EnvironmentPermission(EnvironmentPermissionAccess::Read, S"USERNAME"));
ps2->AddPermission(
   new EnvironmentPermission(EnvironmentPermissionAccess::Write, S"COMPUTERNAME"));
Console::WriteLine(S"Second permission IsSubsetOf first permission = {0}",
   __box(ps2->IsSubsetOf(ps1)));

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Common Language Infrastructure (CLI) Standard

See Also

PermissionSet Class | PermissionSet Members | System.Security Namespace

Show:
© 2014 Microsoft