If you’ve ever worked with a Stack in .NET and needed it to be thread safe, you’ll be interested to note the way that it appears to have been implemented by MS. An object of type Stack has a function called Synchronised() which returns another Stack typed object, but underneath the covers is actually returning a completely internal type called a SyncStack which has the original Stack as a property of it. The stupid thing is, this SyncStack also inherits from Stack so essentially calling Synchronised gets a wrapper stack (assumedly with it’s own store) and an internal stack (which was the one you wanted synchronised). What perplexes me is why they didn’t just make SyncStack publicly available? I can’t create my own fresh Synced Stack I have to make a non-synchronised version of it first.
Can anyone explain this to me please???