Now the title might seem like the question has been asked before but let me explain my situation and you'll see why I am asking this question.
Let's consider this interface :
public interface IListChangedListener {
public event EventHandler ItemAdded;
public event EventHandler ItemRemoved;
}
If someone wants to implement this interface, they would have to check if ItemAdded
is null and only if it is not null, they would call it. Well, I want to simplify their job by giving an in built function which will do the same. Just calling that function will check if the corresponding event is null, and if it isn't, it'll fire its corresponding event.
The problem is, this is an interface. So I can't define a method. So I thought I might go with an abstract class. But considering the situation, it would be best suited to make this as an interface rather than an abstract class.
So do I just drop the idea of giving an in built function? Or do I make it an abstract class? Which better suits the situation? I am having a tough time deciding which one to use. Some help please?
OnItemAdded
andOnItemRemoved
methods that would be called by the collection directly? – Krzysztof Kozielczyk Mar 15 at 23:13