6.2 Supporting Other .NET Languages
C# provides the ability to overload operators for your classes, even
though this is not, strictly speaking, in the Common Language
Specification (CLS). Other .NET languages, such as VB.NET, might not
support operator overloading, and it is important to ensure that your
class supports the alternative methods that these other languages
might call to create the same effect.
Thus, if you overload the addition operator (+),
you might also want to provide an add( ) method
that does the same work. Operator overloading ought to be a syntactic
shortcut, not the only path for your objects to accomplish a given
task.
|