Compiler Error CS1055
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()
{
}
}