GenericPrincipal.IsInRole(String) Méthode

Définition

Détermine si le GenericPrincipal en cours appartient au rôle spécifié.

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

Paramètres

role
String

Nom du rôle pour lequel l'appartenance (membership) doit être vérifiée.

Retours

Boolean

true si le GenericPrincipal en cours est un membre du rôle spécifié ; sinon, false.

Implémente

Exemples

Le code suivant montre l’utilisation de la IsInRole méthode. Cet exemple de code fait partie d’un exemple plus grand fourni pour la GenericPrincipal classe.

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

S’applique à