Someone please correct me if I'm wrong.
As of CSharp 2003 it not possible to define a new operator ie; =+ also some
existing operators cannot be overloaded ie; +=.
Courtesy MSDN Section 7.2.2 Operator Overloading
<<<<<<<< Start Here>>>>>>>>>>
The overloadable unary operators are:
+ - ! ~ ++ -- true false
Although true and false are not used explicitly in expressions, they are
considered operators because they are invoked in several expression
contexts: Boolean expressions (Section 7.16) and expressions involving the
conditional (Section 7.12), and conditional logical operators (Section
7.11).
The overloadable binary operators are:
+ - * / % & | ^ << >> == != > < >= <=
Only the operators listed above can be overloaded. In particular, it is not
possible to overload member access, method invocation, or the =, &&, ||, ?:,
checked, unchecked, new, typeof, as, and is operators.
<<<<<<<< End Here>>>>>>>>>>
So you could choose from any of the above but you might find then a little
meaningless to the next programmer, who might just happen to be you in 6
months time.
My suggestion define a method called EqualsPlus until such a time you can
create custom defined operators.
Regards
Ian
"Elementary Penguin" <si*****@hare.krishna> wrote in message
news:tY***************@newsread3.news.pas.earthlin k.net...
Is there a left add unary operator ( or do I have to overload one ) ?
For example:
string s1 = "A";
s1 += "B";
Console.WriteLine( s1 )
...writes: AB
But, say I want BA.
Is there some kind of
s1 =+ B;
I can overload an operator, but can I create a brand new operator ?
--
Texeme
http://texeme.com