using System.Collections.ObjectModel;
namespace ConsoleApplication4
public static void Main(string[] args)
MyCustomCollection myCollection = new MyCustomCollection();
myCollection.Add("Jane");
public class MyCustomCollection : Collection<string>
protected override void InsertItem(int index, string item)
if (string.IsNullOrEmpty(item))
throw new Exception("Item inserted into collection cannot be null.");
base.InsertItem(index, item);