/// <summary> /// Unloads the specified project content, causing it to be reloaded when /// GetProjectContentForReference is called the next time. /// Warning: do not unload project contents that are still in use! Doing so will result /// in an ObjectDisposedException when the unloaded project content is used the next time! /// </summary> public void UnloadProjectContent(IProjectContent pc) { if (pc == null) { throw new ArgumentNullException("pc"); } LoggingService.Debug("ProjectContentRegistry.UnloadProjectContent: " + pc); lock (_contents) { // find all keys used for the project content - might be the short name/full name/file name List <string> keys = new List <string>(); foreach (KeyValuePair <string, IProjectContent> pair in _contents) { if (pair.Value == pc) { keys.Add(pair.Key); } } foreach (string key in keys) { _contents.Remove(key); } } pc.Dispose(); }
/// <summary> /// Unloads the specified project content, causing it to be reloaded when /// GetProjectContentForReference is called the next time. /// Warning: do not unload project contents that are still in use! Doing so will result /// in an ObjectDisposedException when the unloaded project content is used the next time! /// </summary> public void UnloadProjectContent(IProjectContent pc) { if (pc == null) { throw new ArgumentNullException("pc"); } LoggingService.Debug("ProjectContentRegistry.UnloadProjectContent: " + pc); lock (contents) { // find all keys used for the project content - might be the short name/full name/file name var keys = (from pair in contents where pair.Value == pc select pair.Key).ToList(); foreach (var key in keys) { contents.Remove(key); } } pc.Dispose(); }
/// <summary> /// Unloads the specified project content, causing it to be reloaded when /// GetProjectContentForReference is called the next time. /// Warning: do not unload project contents that are still in use! Doing so will result /// in an ObjectDisposedException when the unloaded project content is used the next time! /// </summary> public void UnloadProjectContent(IProjectContent pc) { if (pc == null) throw new ArgumentNullException("pc"); LoggingService.Debug("ProjectContentRegistry.UnloadProjectContent: " + pc); lock (contents) { // find all keys used for the project content - might be the short name/full name/file name List<string> keys = new List<string>(); foreach (KeyValuePair<string, IProjectContent> pair in contents) { if (pair.Value == pc) keys.Add(pair.Key); } foreach (string key in keys) { contents.Remove(key); } } pc.Dispose(); }