Share via


WindowsPrincipal.Identity プロパティ

定義

現在のプリンシパルの ID を取得します。

public:
 virtual property System::Security::Principal::IIdentity ^ Identity { System::Security::Principal::IIdentity ^ get(); };
public override System.Security.Principal.IIdentity Identity { get; }
public virtual System.Security.Principal.IIdentity Identity { get; }
member this.Identity : System.Security.Principal.IIdentity
Public Overrides ReadOnly Property Identity As IIdentity
Public Overridable ReadOnly Property Identity As IIdentity

プロパティ値

現在のプリンシパルの WindowsIdentity オブジェクト。

実装

次の例では、 オブジェクトの プロパティを使用 Identity してユーザーの名前を WindowsPrincipal 取得します。

WindowsPrincipal^ wp = gcnew WindowsPrincipal( WindowsIdentity::GetCurrent() );
String^ username = wp->Identity->Name;
WindowsPrincipal wp = new WindowsPrincipal(WindowsIdentity.GetCurrent());
string username = wp.Identity.Name;
Dim wp As New WindowsPrincipal(WindowsIdentity.GetCurrent())
Dim username As String = wp.Identity.Name

適用対象