User2.UserName 属性

定义

仅获取用户的用户名。

public:
 property System::String ^ UserName { System::String ^ get(); };
public string UserName { get; }
member this.UserName : string
Public ReadOnly Property UserName As String

属性值

用户的用户名。

示例

在以下示例中,将使用 UserName 属性显示当前用户的登录凭据。

User2 thisUser = thisApplication.User;
thisXDocument.UI.Alert(thisUser.UserName);
Dim thisUser As User2  = thisApplication.User
thisXDocument.UI.Alert(thisUser.UserName)

注解

调用 UserName 属性与调用 System.Environment.UserName 的效果相同。

适用于