GenericPrincipal::IsInRole Method (String^)

 

Determines whether the current GenericPrincipal belongs to the specified role.

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

public:
virtual bool IsInRole(
	String^ role
) override

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( L"NetworkUser" ) )
{
   Console::WriteLine( L"User belongs to the NetworkUser role." );
}

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