Skip to content

Instantly share code, notes, and snippets.

@rafaelrmou
Created May 16, 2017 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafaelrmou/ca30d8a7fb782c9a421ec366515a5f7a to your computer and use it in GitHub Desktop.
Save rafaelrmou/ca30d8a7fb782c9a421ec366515a5f7a to your computer and use it in GitHub Desktop.
DeviceHelper.cs for Xamarin.Forms OnPlatform deprecated
public static class DeviceHelper
{
public static T OnRuntimePlatform<T>(T t1, T t2, T t3, T t4)
{
switch (Device.RuntimePlatform)
{
case Device.Android:
return t1;
case Device.iOS:
return t2;
case Device.WinPhone:
case Device.Windows:
return t3;
default:
return t4;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment