共用方式為


WindowsPrincipal(WindowsIdentity) 建構函式

定義

使用指定的 WindowsIdentity 物件,初始化 WindowsPrincipal 類別的新執行個體。

public:
 WindowsPrincipal(System::Security::Principal::WindowsIdentity ^ ntIdentity);
public WindowsPrincipal (System.Security.Principal.WindowsIdentity ntIdentity);
new System.Security.Principal.WindowsPrincipal : System.Security.Principal.WindowsIdentity -> System.Security.Principal.WindowsPrincipal
Public Sub New (ntIdentity As WindowsIdentity)

參數

ntIdentity
WindowsIdentity

物件,做為建構 WindowsPrincipal 之新執行個體的來源。

例外狀況

ntIdentitynull

範例

下列範例會從目前的 WindowsIdentity 物件建立新的 WindowsPrincipal 物件。

WindowsIdentity^ wi = WindowsIdentity::GetCurrent();
WindowsPrincipal^ wp = gcnew WindowsPrincipal( wi );

WindowsIdentity wi = WindowsIdentity.GetCurrent();
WindowsPrincipal wp = new WindowsPrincipal(wi);

Dim wi As WindowsIdentity = WindowsIdentity.GetCurrent()
Dim wp As New WindowsPrincipal(wi)

適用於