更新: 2008 年 7 月
错误消息
运算符“operator”无法应用在“type”和“type”类型的操作数
二进制运算符所操作的数据类型是该运算符不能处理的数据类型。例如,不能对字符串使用 || 运算符,不能对 struct 类型使用 == 运算符(除非该类型显式重载该运算符)。
示例
在本例中,必须在 ConditionalAttribute 外指定条件逻辑。只能向 ConditionalAttribute 传递一个预定义符号。
下面的示例生成 CS0019。
// CS0019.cs
// compile with: /target:library
using System.Diagnostics;
public class MyClass
{
   [ConditionalAttribute("DEBUG" || "TRACE")]   // CS0019
   public void TestMethod() {}
   // OK
   [ConditionalAttribute("DEBUG")]
   public void TestMethod2() {}
}
请参见
参考
修订记录
| 日期 | 修订记录 | 原因 | 
|---|---|---|
| 2008 年 7 月 | 增加了有关 == 运算符和构造的文本。 | 内容 Bug 修复 |