Compiler Error CS0564
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
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()
{
}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
.NET is an open source project. Select a link to provide feedback: