Operator Overloading
Operator overloading allows existing C# operators to be redefined for use with user-defined types. Operator overloading has been called "syntactic sugar," owing to the fact that the overloaded operator is simply another means of calling a method. It's also been said that the feature doesn't fundamentally add anything to the language. Although this is technically true, operator overloading does aid in one of the most important aspects of object-oriented programming: abstraction.
Suppose that you want to aggregate a collection of invoices for a particular customer. Using operator overloading, you can write code similar to the following in which the += operator is overloaded: -
Invoice summaryInvoice = new Invoice();
foreach (Invoice invoice in customer.GetInvoices())
{
summaryInvoice += invoice;
}
The benefits of such code include its very natural syntax and the fact that the client is abstracted from having to understand the implementation details of how the invoices are being aggregated. Simply put, operator overloading aids in creating software that is less expensive to write and maintain.