GenericPrincipal.IsInRole(String) GenericPrincipal.IsInRole(String) GenericPrincipal.IsInRole(String) GenericPrincipal.IsInRole(String) Method


Determines whether the current GenericPrincipal belongs to the specified role.

 override bool IsInRole(System::String ^ role);
public override bool IsInRole (string role);
override this.IsInRole : string -> bool
Public Overrides Function IsInRole (role As String) As Boolean


String String String String

The name of the role for which to check membership.


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( L"NetworkUser" ) )
   Console::WriteLine( L"User belongs to the NetworkUser role." );
if (genericPrincipal.IsInRole("NetworkUser"))
    Console.WriteLine("User belongs to the NetworkUser role.");
If (genericPrincipal.IsInRole("NetworkUser")) Then
    WriteLine("User belongs to the NetworkUser role.")
End If

Applies to