I am trying to use Java library inside Xamarin project through binding. I need to pass a C sharp class type as a parameter to a Java method.
typeof()
method in C sharp doesn't work because the compiler compilations
Cannot implicitly convert type "System.Type" to "Java.Lang.Class"
Is there any way to convert it correctly?
Try to use Java.Lang.Class.FromType(Type)
in Xamarin.
For example, your C sharp class could be Car
then call it as Java.Lang.Class.FromType(typeof(Car))
in Xamarin
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With