here's a bit info for you fellas:
eg.. you have Square classes u wanna add
public static int operator+ (Square s1, Square s2)
{
// your code here
}
comparision operators..
public static bool operator==(Square s1, Square s2)
{
// your code here
}
public static bool operator!=(Square s1, Square s2)
{
// your code here
}
note that you need to do comparison operators in pairs..
ie..
== and !=
< and >
In Summary:
Operators Overloadability
+, -, *, /, %, &, |, <<, >> All C# binary operators can be
overloaded.
+, -, !, ~, ++, --, true, false All C# unary operators can be
overloaded.
==, !=, <, >, <= , >= All relational operators can be
overloaded,
but only as pairs.
&&, || They can't be overloaded
() (Conversion operator) They can't be overloaded
+=, -=, *=, /=, %= These compound assignment operators can
be
overloaded. But in C#, these operators
are
automatically overloaded when the
respective
binary operator is overloaded.
=, . , ?:, ->, new, is, as, sizeof These operators can't be overloaded