GenericPrincipal.IsInRole(String) Yöntem

Tanım

Geçerlinin GenericPrincipal belirtilen role ait olup olmadığını belirler.

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

Parametreler

role
String

Üyeliğin denetlendiği rolün adı.

Döndürülenler

Boolean

true geçerli GenericPrincipal belirtilen rolün üyesiyse; değilse, false.

Uygulamalar

Örnekler

Aşağıdaki kod yönteminin IsInRole kullanımını gösterir. Bu kod örneği, sınıfı için GenericPrincipal sağlanan daha büyük bir örneğin parçasıdır.

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

Şunlara uygulanır