Compiler Error CS0073
An add or remove accessor must have a body
An add or remove keyword in an event definition must have a body. For more information, see Events.
The following sample generates CS0073:
// CS0073.cs
delegate void del();
class Test
{
public event del MyEvent
{
add; // CS0073
// try the following lines instead
// add
// {
// MyEvent += value;
// }
remove
{
MyEvent -= value;
}
}
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: