Search code examples
c#-4.0windows-phone

C# platform detection between Desktop and Mobile devices


How can I detect if I'm running a Windows Phone or a regular Windows in C# ? (for Windows 8, 8.1, 10)

C# can be run on those two kind of platforms.


Solution

  • You can use precompilation directives such as WINDOWS_APP and WINDOWS_PHONE_APP to detect regular windows or mobile devices.

    You can see more information on this MSDN blog post here: http://blogs.msdn.com/b/cdndevs/archive/2015/03/06/universal-applications-be-ready-for-windows-10-part-1.aspx

    Hope that helps! :)

    Shahed