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
[ ] Can be overloaded but not always!
资料来源
支架:
public Object this[int index]
{
}
# #但
数组索引操作符不能重载;但是,类型可以定义索引器,即接受一个或多个参数的属性。索引器参数被括在方括号中,就像数组索引一样,但是索引器参数可以声明为任何类型(与数组索引不同,数组索引必须是整数)。
从MSDN