Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我提到
char operator;
它给出了 c# 中预期的错误一元运算符。
所以当它提到给 extern 并且 android 中的默认值是 '\u0000'
operator是 C# 中的保留字。如果你想用它作为标识符,那么你必须在它前面加上@,或者干脆选择一个不同的名字:
operator
@
char operator; // Invalid, operator is a reserved word. char oper; // Valid. char @operator; // Also valid.
错误消息源于编译器认为您正在尝试重载运算符,因此它期望operator关键字后跟运算符,如下所示:
static char operator+(Foo a, Foo b) { ... }