Error del compilador CS0564

Actualización: noviembre 2007

Mensaje de error

El primer operando de un operador de desplazamiento sobrecargado debe tener el mismo tipo que el tipo contenedor, y el tipo del segundo operando debe ser int
The first operand of an overloaded shift operator must have the same type as the containing type, and the type of the second operand must be int

Se intentó sobrecargar un operador de desplazamiento (<< or >>) mediante operandos con tipos incorrectos. El primer operando debe ser el tipo y el segundo debe ser del tipo int.

El código siguiente genera el error 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() 
   {
   }
}