How to write nfloat literal?

I port my code to the new unified xamarin.ios api.

I have it as a parameter in a method.

nfloat fontSize = 0f

The compiler complains ...

Error CS1750: Optional parameter expression of type `float' cannot be converted to parameter type `System.nfloat'

How to write a literal for optional parameter nfloat?

+4
source share
1 answer

You can not.

Native types Xamarin.iOS / Xamarin.Mac ( nfloat, nint, nuint) are not intrinsic managed types, so you can not create these types of constants.

+4
source

All Articles