語言

WindowsPrincipal(WindowsIdentity) 建構函式

定義

使用指定的 WindowsPrincipal 物件,初始化 WindowsIdentity 類別的新實例。

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。

例外狀況

ntIdentity 是 null。

範例

以下範例從目前WindowsPrincipal物件建立一個新WindowsIdentity物件。

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)

適用於