public ConfigReaderWriter(Stream file, Encoding encoding, string rootSection) { _file = file; _encoding = encoding; RootSection = new Section(rootSection); KVPs = new EnhancedObservableCollection <ConfigKVP>( KVPExtractor.ExtractAll(new StreamReader(_file, _encoding))); KVPs.CollectionChanged += Config_CollectionChanged; if (!file.CanWrite) { KVPs.MakeReadOnly(); } }