This code seems to be making _cleanRepositoryCollection a reference to _currentTextFile.RepositoryCollection instead of making it a copy of _currentTextFile.RepositoryCollection:
_cleanRepositoryCollection = _currentTextFile.RepositoryCollection;
The datatype is List<Repository>.
No, you’re not imagining things. That stores a reference to the list returned by
_currentTextFile.RepositoryCollection.Now, this may be a reference to
_currentTextFile‘s internalRepositoryCollectionlist, or it may be a copy — it depends on the implementation of theRepositoryCollectionproperty.If you want to ensure that you have a copy, you need to make the copy yourself.