Platform-specific XAML and C#
While Uno Platform allows you to run your app on any platform without having to worry about the underlying platform-specific API, there are still cases where you might want to write code that is specific to a platform, for example, accessing native platform APIs.
Platform-specific C#
Writing platform-specific C# code is similar to writing architecture-specific or runtime-specific C# code. Uno Platform ships with a set of compiler symbols that will be defined when your code is being compiled for a specific platform. This is achieved using preprocessor directives. Preprocessor directives will only be respected by the compiler if the symbol was set for the compilation, otherwise, the compiler will completely ignore the preprocessor directive.
At the time of writing, Uno Platform comes with the following preprocessor directives:
NETFX_CORE
for UWP__ANDROID__
for Android__IOS__
for iOSHAS_UNO_WASM
(or__WASM__
) for the web using...