GenericPrincipal.IsInRole Method (String)

 

Determines whether the current GenericPrincipal belongs to the specified role.

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

Public Overrides Function IsInRole (
	role As String
) As Boolean

Parameters

role
Type: System.String

The name of the role for which to check membership.

Return Value

Type: System.Boolean

true if the current GenericPrincipal is a member of the specified role; otherwise, false.

The following code shows the use of the IsInRole method. This code example is part of a larger example provided for the GenericPrincipal class.

If (genericPrincipal.IsInRole("NetworkUser")) Then
    WriteLine("User belongs to the NetworkUser role.")
End If

Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Return to top
Show: