Hi,
We're trying to data bind to a HashSet but found that it isn't working as expected.
var list = new HashSet<string>();
list.Add("David");
list.Add("Peter");
list.Add("Paul");
list.Add("Mary");
list.Add("Gillian");
var bindingSource = new BindingSource {DataSource = list};
bindingSource.RemoveAt(0);
Debug.Assert(list.Count == 4); // Fails as count = 5
If the collection is an IList<>, then as soon as an item is removed from the binding source then this is reflected in the underlying collection. However, with a HashSet<> collection, the underlying collection doesn't get updated.
Why do they not behave the same?
Dave