/// <summary> /// Remove a content item from the collection /// </summary> /// <param name="key"></param> public void Remove(string key) { if (Loaded) { throw new InvalidOperationException("Cannot remove content while the ContentCollection is loaded"); } if (key is null) { throw new ArgumentNullException(nameof(key)); } if (key.Length == 0) { throw new ArgumentException("key.Length must be > 0", nameof(key)); } var ind = ContentItems.FindIndex(e => e.Key == key); if (ind < 0) { throw new ArgumentException($"key \"{key}\" does not refer to any content", nameof(key)); } ContentItems.RemoveAt(ind); }