This documentation is archived and is not being maintained.

Compiler Error CS0019 

Error Message

Operator 'operator' cannot be applied to operands of type 'type' and 'type'

A binary operator is operating on data types for which it was not designed. For example, you cannot use the || operator on strings.


In this example, conditional logic must be specified outside the ConditionalAttribute. You can only pass one predefined symbol to the ConditionalAttribute.

The following sample generates CS0019.

// CS0019.cs
// compile with: /target:library
using System.Diagnostics;
public class MyClass
   [ConditionalAttribute("DEBUG" || "TRACE")]   // CS0019
   public void TestMethod() {}

   // OK
   public void TestMethod2() {}

See Also