WindowsIdentity.Name 属性
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取用户的 Windows 登录名。
public:
virtual property System::String ^ Name { System::String ^ get(); };
public override string Name { get; }
public virtual string Name { get; }
member this.Name : string
Public Overrides ReadOnly Property Name As String
Public Overridable ReadOnly Property Name As String
用户的 Windows 登录名,当前即以该用户的名义运行代码。
以下代码演示如何使用 Name 属性获取用户的 Windows 登录名。 此代码示例是为 WindowsIdentity 类提供的一个更大示例的一部分。
propertyDescription = String::Concat( propertyDescription, windowsIdentity->Name );
propertyDescription += windowsIdentity.Name;
propertyDescription += windowsIdentity.Name
登录名采用 DOMAIN\USERNAME 格式。
产品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
Windows Desktop | 3.0, 3.1, 5 |