Compiler Error CS1676
Parameter 'number' must be declared with the 'keyword' keyword
This error occurs when the parameter type modifier in an anonymous method is different from that used in the declaration of the delegate you are casting the method to.
The following sample generates CS1676:
C#
// CS1676.cs
delegate void E(ref int i);
class Errors
{
static void Main()
{
E e = delegate(out int i) { }; // CS1676
// To resolve, use the following line instead:
// E e = delegate(ref int i) { };
}
}
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: