Environment Checks  

PDF for offline use

Let us know how you feel about this

Translation Quality


0/250

This recipe shows how to make various environment checks from your code to handle different runtime environments.

 

 Check the macOS Version

The macOS operating system version can be checked like this:

if (NSProcessInfo.ProcessInfo.IsOperatingSystemAtLeastVersion (new NSOperatingSystemVersion (10, 10, 0))) {
                // API available on macOS 10.12+
} else {
   // Code to support earlier iOS versions
}

Note This is only available in 10.10 and above.

Xamarin Workbook

If it's not already installed, install the Xamarin Workbooks app first. The workbook file should download automatically, but if it doesn't, just click to start the workbook download manually.