How to get the objc selector of a RO C# method?

public class MyClass{
    public void simple(int a){
    }// method1

    public void simple(int a, int b){
    }// method2
}

I know the method1 can be expressed like: var sel = __selector(simple:);

Then how to express the method2? I’ve tried sth like __selector(simple:b:) and it won’t work.

you’ll probably want __selector(simple::) there, __selector(simple:b:) would match:

    public void simple(int a) b (int b){
    }// method2

Thanks!
Another question for overload methods:

public void simple(int a, bool b){
}

public void simple(int a, int b){
}

I think the compiler will rename the “simple”. Can we refer to them by selector?

Not easily. When you use selectors you should make sure they have a distinct name so they don’t get mangled. What do you need the selector name for?

Got it. I’m trying to make some cross-platform reflection utils and learning objc runtime to see if there’re specific limits.

ah. Well you CAN get/invoke these. They just have a very long name.

Is there a convenient way to print compiled method names?
I’ve learned that all objc methods will have two hidden arguments: “self” and “_cmd”, but it seems that I can’t refer to “_cmd” in RO C#.

hrm one way to do it is to set<IRFilename>filename.ir</IRFilename> in your project files. The IR will have the IR for the project (but that’s not easy to read). Another way is to dump them through the objc apis.

as for “cmd”, not currently. do you have any usecase for it?

There’re only debug cases for it currently, not urgent.

Can we use the @encode compiler directive as below mentioned in RO C#?
https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtTypeEncodings.html#//apple_ref/doc/uid/TP40008048-CH100-SW1

Not currently no.

Thanks, logged as bugs://73306 — for @encode support

Thanks, logged as bugs://73307 — to expose _cmd

bugs://73306 got closed with status wontfix.