Lets say we have this interface:
public interface ILog
{
void Add(Message message);
}
It should of course also have some way of accessing those added messages. But what do you think is more natural and correct? That ILog implements IEnumerable property? Or maybe both? Or will having both be a bit weird and unecessary? Or should it maybe be an IEnumerator instead of IEnumerable? (Or that is maybe completely wrong? Haven't quite grasped the difference between those...)
public interface ILog : IEnumerable<Message>
{
void Add(Message message);
}
public interface ILog
{
IEnumerable<Message> Messages { get; }
void Add(Message message);
}
public interface ILog : IEnumerable<Message>
{
IEnumerable<Message> Messages { get; }
void Add(Message message);
}
This is of course probably a bit subjective, but I would like to hear others opinion. I don't really know, nor have I anyone else to ask :p