I’m trying to get the list of defined operators for a specific type in order to see what kind of operations can be applied to that type.
For example, the type Guid supports operations == and !=.
So if user wants to apply <= operation for a Guid type I can handle this situation before an exception occurs.
Or if I could have the list of operators, I can force user to use only operations in the list.
The operators are seen in the object browser so there may be a way to access them via reflection but I couldn’t find that way.
Any help will be appreciated.
Get the methods with
Type.GetMethods, then useMethodInfo.IsSpecialNameto discover operators, conversions etc. Here’s an example: