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

示例

以下示例从当前 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)

适用于