Compiler Error CS0558
User-defined operator 'operator' must be declared static and public
Both the static and public access modifiers must be specified on user-defined operators.
The following sample generates CS0558:
// CS0558.cs
namespace x
{
public class ii
{
public class iii
{
static implicit operator int(iii aa) // CS0558, add public
{
return 0;
}
}
public 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: