I have a system with a structure like this:The ConcreteWriteable is caching the ReadOnlyWrapper.This is a similar system to what .Net's System.Array uses for its Array.AsReadOnly<T>(T[] array) method (ignoring for the moment that System.Array's AsReadOnly is static). However looking at the code for System.Array at reference source, System.Array.AsReadOnly is returning a new wrapper each time, whereas I'm creating the wrapper at the same time as the ConcreteWriteable and caching it, then returning the same one each time.This got me thinking, is there some reason why I shouldn't be doing this? Is there some reason why creating a new wrapper each time is more desirable than returning the same wrapper (bearing in mind that the wrapper cannot possibly change the ConcreteWriteable and is indeed a wrapper, not a copy)?
To cache or not to cache a ReadOnlyWrapper object?
design