共用方式為


UserInformation.GetDisplayNameAsync 方法

定義

取得使用者帳戶的顯示名稱。

重要

Windows 10或更新版本不支援UserInformation類別。 請改用 User 類別。 請參閱 UserInformation 類別檔中的。

public:
 static IAsyncOperation<Platform::String ^> ^ GetDisplayNameAsync();
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<winrt::hstring> GetDisplayNameAsync();
/// [Windows.Foundation.Metadata.RemoteAsync]
/// [Windows.Foundation.Metadata.Deprecated("Use User instead of UserInformation. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 131072, "Windows.System.UserProfile.UserProfileContract")]
 static IAsyncOperation<winrt::hstring> GetDisplayNameAsync();
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<string> GetDisplayNameAsync();
[Windows.Foundation.Metadata.RemoteAsync]
[Windows.Foundation.Metadata.Deprecated("Use User instead of UserInformation. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 131072, "Windows.System.UserProfile.UserProfileContract")]
public static IAsyncOperation<string> GetDisplayNameAsync();
function getDisplayNameAsync()
Public Shared Function GetDisplayNameAsync () As IAsyncOperation(Of String)

傳回

IAsyncOperation<String>

IAsyncOperation<Platform::String>

IAsyncOperation<winrt::hstring>

使用者帳戶的顯示名稱。

屬性

備註

重要

Windows 10或更新版本不支援UserInformation類別。 請改用 User 類別。 請參閱 UserInformation 類別檔中的。

例如,如果 UserInformation.NameAccessAllowed 屬性為 false) ,則隱私權設定 (可以封鎖顯示名稱的存取。 如果存取遭到封鎖,這個方法會傳回空字串。

這個方法不會擲回例外狀況。

適用於

另請參閱