共用方式為


DiagnosticsSettings.GetForUser(User) 方法

定義

擷取指定使用者的診斷設定。

public:
 static DiagnosticsSettings ^ GetForUser(User ^ user);
 static DiagnosticsSettings GetForUser(User const& user);
public static DiagnosticsSettings GetForUser(User user);
function getForUser(user)
Public Shared Function GetForUser (user As User) As DiagnosticsSettings

參數

user
User

要為其取得設定的使用者。

傳回

包含使用者目前診斷設定的 settings 物件。

範例

// From a multi-user environment.
// (This example queries for all users, but you presumably
// know the user you want to query in your app.)

Task<IReadOnlyList<Windows.System.User>> getUsersTask =
    Windows.System.User.FindAllAsync().AsTask();
if (!getUsersTask.IsCompleted)
{
    getUsersTask.Wait();
}

IEnumerable<Windows.System.User> users = getUsersTask.Result;

foreach(Windows.System.User user in users)
{
    Windows.System.UserProfile.DiagnosticsSettings userSettings =
        Windows.System.UserProfile.DiagnosticsSettings.GetForUser(user);

    System.Diagnostics.Debug.WriteLine(user.NonRoamableId.ToString() +
        " user tailored experiences enabled: " +
        userSettings.CanUseDiagnosticsToTailorExperiences.ToString());
}

適用於