We can use a set of preprocessor directives in order do define different code for each platform. This option is available only in a Xamarin.Forms shared projects.
#if __IOS__
// iOS code
#elif __ANDROID__
// Android code
#elif WINDOWS_UWP
// Universal Windows Platform code
#elif WINDOWS_APP
// Windows 8.1 code
#elif WINDOWS__PHONE_APP
// Windows Phone 8.1 code
#endif