AnalyticsInfo.GetSystemPropertiesAsync(IIterable<String>) 方法

定义

异步检索请求的系统属性。

public:
 static IAsyncOperation<IMapView<Platform::String ^, Platform::String ^> ^> ^ GetSystemPropertiesAsync(IIterable<Platform::String ^> ^ attributeNames);
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<IMapView<winrt::hstring, winrt::hstring const&>> GetSystemPropertiesAsync(IIterable<winrt::hstring> const& attributeNames);
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<IReadOnlyDictionary<string,string>> GetSystemPropertiesAsync(IEnumerable<string> attributeNames);
function getSystemPropertiesAsync(attributeNames)
Public Shared Function GetSystemPropertiesAsync (attributeNames As IEnumerable(Of String)) As IAsyncOperation(Of IReadOnlyDictionary(Of String, String))

参数

attributeNames

IIterable<String>

IEnumerable<String>

IIterable<Platform::String>

IIterable<winrt::hstring>

包含要检索的系统属性的字符串 的 IIterable 列表。

返回

IAsyncOperation<IMapView<String,String>>

IAsyncOperation<IReadOnlyDictionary<String,String>>

IAsyncOperation<IMapView<Platform::String,Platform::String>>

IAsyncOperation<IMapView<winrt::hstring,winrt::hstring>>

返回一个 IAsyncOperation 对象,该对象指示任务已完成并包含 IMapView 对象,其请求的属性为键/值对。

属性

Windows 要求

设备系列
Windows 10, version 1803 (在 10.0.17134.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v6.0 中引入)

示例

using Windows.System.Profile;

// ...

var attrNames = new List<string>({"DeviceFamily", "OSVersionFull", "FlightRing"});
var attrData = AnalyticsInfo.GetSystemPropertiesAsync(attrNames).AsTask().GetAwaiter().GetResult();

// The map can be serialized and sent to a backend service for analytics or targeting 
foreach (KeyValuePair<string, string> attr in attrData) 
{ 
    Console.WriteLine($"{attr.Key}={attr.Value}");
}

注解

attributeNames 参数支持的值可能是无限的。 有许多提供程序可以挂钩并公开任意值。 可能支持一些已知属性。 在大多数情况下,这些区分大小写:

  • 应用
  • AppVer
  • DeviceFamily
  • FlightRing
  • OSVersionFull

此方法的目的是仅将此信息用于分析,而不依赖于客户端上的特定值。 对这些值的支持将随着时间的推移而改变。

适用于