How to convert system type (C sharp) to java lang class

I am trying to use the Java library inside a Xamarin project through binding . I need to pass class C to class type as a parameter for a Java method.

typeof() method in C sharp does not work because compilers compile

Cannot implicitly convert type "System.Type" to "Java.Lang.Class"

Is there a way to convert it correctly?

+4
source share
1 answer

Try using Java.Lang.Class.FromType(Type)in Xamarin.

For example, your C-class might be Car

then name it Java.Lang.Class.FromType(typeof(Car))in xamarin

+10
source

All Articles