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

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

戻り値

現在の GenericPrincipal が、指定したロールのメンバーの場合は true。それ以外の場合は false

実装

次のコードは、 メソッドの使用方法を 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

適用対象