GenericPrincipal.IsInRole(String) Metoda

Definicja

Określa, czy bieżący GenericPrincipal należy do określonej roli.

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

Parametry

role
String

Nazwa roli, dla której ma być sprawdzane członkostwo.

Zwraca

Boolean

true jeśli bieżący GenericPrincipal jest członkiem określonej roli; w przeciwnym razie false.

Implementuje

Przykłady

Poniższy kod przedstawia użycie IsInRole metody . Ten przykład kodu jest częścią większego przykładu udostępnionego GenericPrincipal dla klasy .

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

Dotyczy