I need to create a custom collection that implements IBindingList in order to be able to bind it with a custom control from 3rd party. Another problem that I have is that I have to make that collection thread safe because I manually insert items from multiple threads simultaneously.
Anyways I am using a BindingList<T> as a field on my class in order to don't reinvent the wheel to much. So my class looks like:
class ThreadSaveBindingCollection<T> : IEnumerable<T>, IBindingList
{
BindingList<T> collection;
object _lock = new object();
// constructors
public ThreadSaveBindingCollection(IEnumerable<T> initialCollection)
{
if (initialCollection == null)
collection = new BindingList<T>();
else
collection = new BindingList<T>(new List<T>(initialCollection));
}
public ThreadSaveBindingCollection() : this(null)
{
}
// Todo: Implement interfaces using collection to do the work
}
Note I am missing to implement the interface IEnumerable and IBinding list. I am planning for the field collection to take care of that as it implements those interfaces as well. So I let visual studio implement the interface explicitly and replace the throw new NotImplementedException() with the field collection implementation and I end up with something like:

Now the question is
Why I cannot call the method AddIndex on the field collection if collection claims to implement IBindingList!?

I am not able to do the same thing for several of the methods