I have something that works like a fixed size list - it's actually called FixedSizeStack<T>
in my program. I will use it to represent the X last occured events. This event list will then be examined by different observers, and if they detect patterns they will trigger some action.
Naturally, I see no reason for them to know of FixedSizeStack<T>
- to me it makes sense to present it to the actions as IEnumerable. I am considering giving them this event list in their constructors, then calling something like PreviewEvent(Event e);
and EventOccured();
and they will iterate over this IEnumerable.
I feel a little queasy enumerating this IEnumerable multiple times, and making it part of the contract that the enumeration changes - do you think this is a reasonable method?