GenericPrincipal.IsInRole(String) メソッド

定義

現在の GenericPrincipal が指定したロールに属しているかどうかを判断します。

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

パラメーター

role
String

メンバーシップを確認するロールの名前。

返品

現在の が指定されたロールのメンバーである場合は 2a0/& 。それ以外の場合は。

実装

次のコードは、 IsInRole メソッドの使用方法を示しています。 このコード例は、 GenericPrincipal クラスに提供されるより大きな例の一部です。

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

適用対象