runtime icon indicating copy to clipboard operation
runtime copied to clipboard

Question: best way to get operator method in reflection

Open lilinus opened this issue 2 years ago • 3 comments

Question: What is best practice to find an operator overload method in reflection?

I believe the names of the methods are for example "op_Addition" and such, but I can't find any official documentation on this.

Is there good way to do this without using magic string based on inofficial information?

What I'm trying to implement a IQueryExpressionInterceptor, in which i need to identify for example the addition operator.

lilinus avatar Feb 14 '24 09:02 lilinus

Tagging subscribers to this area: @dotnet/area-system-reflection See info in area-owners.md if you want to be subscribed.

Issue Details

Question: What is best practice to find an operator overload method in reflection?

I believe the names of the methods are for example "op_Addition" and such, but I can't find any official documentation on this.

Is there good way to do this without using magic string based on inofficial information?

What I'm trying to implement a IQueryExpressionInterceptor, in which i need to identify for example the addition operator.

Author: lilinus
Assignees: -
Labels:

area-System.Reflection, untriaged

Milestone: -

ghost avatar Feb 14 '24 09:02 ghost

You can find all of the operator method names documented here.

DaZombieKiller avatar Feb 14 '24 20:02 DaZombieKiller

Yes the name can be checked; I am not aware of a property or other way to determine whether a given method is an operator overload.

steveharter avatar Feb 14 '24 21:02 steveharter