oop - explicitly mark parameter as mutating in c# -


i have large amount of code dependent on list of objects. list modified lot while being passed around parameter various methods.

even though i understand workings of code, feel uneasy letting such easy opportunity make mistake exist. there way handle situation in c# outside of goofy comment or refactoring?

if passing list<something> around in code, "mutable" default, , there no way signal explicitly.

if language background issue (haskell?), in c# should looks things different perspective: if wanted pass around immutable collection, need use different type (maybe ienumerable<something>, if it's not same list); if you're passing around list, instead, can modified every method receives it.


Comments

Popular posts from this blog

python - jinja2: TemplateSyntaxError: expected token ',', got 'string' -

Qt4: how to send QString inside a struct via QSharedMemory -

node.js - NodeJS remote terminal to Dropbear OpenWRT-Server -