\Program.cs(13,20): warning CS0219: The variable 'foo' is assigned but its value is never used
In this case, CS0219 is the warning regarding variables being assigned but not used. You can either use the /nowarn:0219 flag, or add the error number in the properties pane for the project (under "Build", remember to remove the leading CS). Keep in mind the supresses all warnings of this class.
This appears to be warning 67 and can thus be suppressed with:
#pragma warning disable 67
Don't forget to restore it as soon as possible (after the event declaration) with:
#pragma warning restore 67
However, I'd check again and make sure you're raising the event somewhere, not just subscribing to it. The fact that the compiler spits out 20 warnings and not 20 errors when you comment out the event is also suspicious...
There's also an interesting article about this warning and specifically how it applies to interfaces; there's a good suggestion on how to deal with "unused" events. The important parts are:
The right answer is to be explicit about what you expect from the event, which in this case, is nothing:
This will cleanly suppress the warning, as well as the extra compiler-generated implementation of a normal event. And as another added benefit, it prompts one to think about whether this do-nothing implementation is really the best implementation. For instance, if the event isn't so much unimportant as it is unsupported, such that clients that do rely on the functionality are likely to fail without it, it might be better to explicitly indicate the lack of support and fail fast by throwing an exception:
public event EventHandler Unsupported
{
add { throw new NotSupportedException(); }
remove { }
}
Of course, an interface that can be usefully implemented without some parts of its functionality is sometimes an indication that the interface is not optimally cohesive and should be split into separate interfaces.