Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Method Names for Operator Methods in C#

Does anyone have a exhaustive list of the names that C#/CLR gives to operators? (Maybe my lack of sleep is kicking in, but I can't seem to find it on Google) E.g. op_Addition, op_Subtraction. Furthermore is there any chance that these would be different in other cultures?

I am trying to create a class that can add/subtract etc. two objects and I have done all the primitives - I just need to do the 'rest'.

Many thanks.

like image 605
Jonathan C Dickinson Avatar asked Dec 10 '22 21:12

Jonathan C Dickinson


1 Answers

Based on the Expression class:

== op_Equality
!= op_Inequality
>  op_GreaterThan
<  op_LessThan
>= op_GreaterThanOrEqual
<= op_LessThanOrEqual
&  op_BitwiseAnd
|  op_BitwiseOr
+  op_Addition
-  op_Subtraction
/  op_Division
%  op_Modulus
*  op_Multiply
<< op_LeftShift
>> op_RightShift
^  op_ExclusiveOr
-  op_UnaryNegation
+  op_UnaryPlus
!  op_LogicalNot
~  op_OnesComplement
   op_False
   op_True
++ op_Increment
-- op_Decrement
like image 112
IS4 Avatar answered Dec 25 '22 11:12

IS4