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 expected
If your event is not declared as a field, it must define both add and remove accessor functions.
The following sample generates CS1055:
// CS1055.cs
delegate void del();
class Test
{
public event del MyEvent
{
int i; // CS1055
// uncomment accessors and delete previous line to resolve
// add
// {
// MyEvent += value;
// }
// remove
// {
// MyEvent -= value;
// }
}
public static void Main()
{
}
}