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

要获取其设置的用户。

返回

包含用户当前诊断设置的设置对象。

示例

// 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());
}

适用于