GenericPrincipal.IsInRole(String) Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
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
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 à
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de l’année 2024, nous abandonnerons progressivement le mécanisme de retour d’information GitHub Issues pour le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultez :Soumettre et afficher des commentaires pour