xamarin.iosprinter-control-language

How to access methods of imported PCL library in Xamarin ios project


i have imported a PCL library into my Xamarin IOS project. I can access the class but not the methods under it

  1. I tried by making the method "static" in oder to access it Classsname.methodName but it doesnt work
  2. I have tried to create an instance of the class and tried to access the method, this also doesnt work

Any help will be appreciated !!


Solution

  • If we don't specify accessibility level, Class is internal by defalut , method is Privateby default, so as MilanG suggested, you should make the method Public if you want to access it.

    Without public

    public class Class1
    {
        void test() {
    
        }
    }
    

    enter image description here

    With public

    public class Class1
    {
        public void test() {
    
        }
    }
    

    enter image description here

    PS:If it still doesn't work, try to clean and rebuild the PCL library.