检查 Windows 10 通用应用程序上的平台

Check platform on Windows 10 Universal App

如何查看我的应用程序是哪个平台(Windows / Windows Phone)运行?

是的,您可以使用编译器指令

#if WINDOWS_PHONE 
//some code
#endif

#if WINDOWS 
//some code
#endif

VersionInfo | versionInfo property应该可以帮忙查看平台信息

    var str = Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily;
    if (str == "Windows.Desktop")
    {
      //...
    }
    else if (str == "Windows.Mobile")
    {
      //...
    }