You must use a read-only assembly if you want to ensure that no one can modify this collection. This, by the way, does not mean that the caller will not be able to modify the contents of this collection.
var collection = List<object> {new SomeObject{...}, new SomeObject{..}};
As others have said, there is no difference between the two challenges present in the question.
source share