Operator Overloading in C#

We can overload an operator using the operator keyword followed by the symbol for the operator. In this example, we will overload an + operator to append comma with the strings. Since + is a binary operator, we need two instances of the string. In this example, we will write a class called CommaStr and have a static method with name ‘+’ which acts as an overloaded operator function. Unlike C++, Operator Overloading can be done for very specific operators in C#. You can refer MSDN for list of operators that can support overloading.