Sorry to not surprise you... As you know this has been depreciated, the idea is to use Device.RuntimePlatform
which returns a string
.
No, there is no other method unless you make one. If you really dislike the switch
syntax, you could use a switch expression though
var something = Device.RuntimePlatform switch
{
"iOS" => new Thickness(0, 20, 0, 0),
"Android" => new Thickness(0, 10, 0, 0),
"WinPhone" => new Thickness(0, 10, 0, 0),
_ => throw new ArgumentOutOfRangeException()
};
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…