EventBase design question

Feb 27, 2009 at 10:10 PM
I noticed that the EventBase class has a private readonly member (_subscriptions) of type List<IEventSubscriptions>.  I then noticed that there is a protected member (Subscriptions) of type ICollection<IEventSubscription> that returns _subscriptions.  For the most part it looks like Subscriptions is used pretty much everywhere.  The only place that I can see _subscriptions being used is in PruneAndReturnStrategies.  After looking at it I realized that I wasn't sure why it was done this way.  Could anyone shed some light on this design?  When does it make sense to take this approach and when does it not?  Is it good when you are multi-threading or have the potential to multi-thread?  Or is it just good practice in general?  Thanks in advance for any insight.
Mar 4, 2009 at 5:15 PM
Hi Emj,

I wasn't on the team when this piece of code was created, so I can't be 100% sure but, I don't think this was done with any specific reason.

In my opinion, the same could have been achieved with

protected

 

ICollection<IEventSubscription> Subscriptions

 

{get; private set;}

And just use the Subscriptions member everywhere.

_Erwin