Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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 (C# Programming Guide).
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()
{
}
}