语言

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)

适用于