Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I write an nfloat literal?

Tags:

xamarin.ios

I'm porting my code to the new unified xamarin.ios api.

I have this 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 do I write a literal for an optional parameter of nfloat?

like image 734
Felix Avatar asked Dec 04 '14 03:12

Felix


1 Answers

You can't.

The native types in Xamarin.iOS/Xamarin.Mac (nfloat, nint, nuint) are not intrinsic managed types, and thus you can't create constants of those types.

like image 145
Rolf Bjarne Kvinge Avatar answered Sep 29 '22 21:09

Rolf Bjarne Kvinge