Export (0) Print
Expand All
Expand Minimize

Compiler Error CS0564 

Error Message

Overloaded shift operator must have the type of the first operand be the containing type, and the type of the second operand must be int.

You attempted to overload a shift operator (<< or >>) with incorrectly typed operands. The first operand must be the type and the second operand must be of the type int.

The following sample generates CS0564:

// CS0564.cs
using System;
class C
{
   public static int operator << (C c1, C c2) // CS0564
// To correct, change second operand to int, like so:
// public static int operator << (C c1, int c2)
   {
      return 0;
   }
   static void Main() 
   {
   }
}

Community Additions

ADD
Show:
© 2014 Microsoft