Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在Windows Phone上获取区域设置_C#_Windows Phone 8 - Fatal编程技术网

C# 如何在Windows Phone上获取区域设置

C# 如何在Windows Phone上获取区域设置,c#,windows-phone-8,C#,Windows Phone 8,我想知道如何获取设备的区域设置?我可以找到语言和地区格式,但找不到国家/地区您可以使用CultureInfo CultureInfo.CurrentCulture RegionInfo.CurrentRegion 你可以用 RegionInfo.CurrentRegion 这将为您提供地区/国家的信息如果您正在开发UWP应用程序,您应该使用 Windows.System.UserProfile.GlobalizationPreferences.HomeGeographicRegion

我想知道如何获取设备的区域设置?我可以找到语言和地区格式,但找不到国家/地区

您可以使用CultureInfo

 CultureInfo.CurrentCulture

RegionInfo.CurrentRegion
你可以用

RegionInfo.CurrentRegion

这将为您提供地区/国家的信息

如果您正在开发UWP应用程序,您应该使用

Windows.System.UserProfile.GlobalizationPreferences.HomeGeographicRegion

正如这里回答的那样:

很遗憾,这只提供了地区格式设置,而不是国家/地区设置。除了可以直接从RegionInfo.currentRegion获得的国家/地区名称之外,您是否可以更具体地说明您想要什么?如果您转到电话设置并选择语言+地区,我正在尝试获取该值对于国家/地区RegionInfo.CurrentRegion,在区域格式设置中为我提供了值。不幸的是,这些没有提供国家/地区设置。。。CurrentCulture提供电话语言,CurrentRegion提供区域格式设置可能重复的