iterating through item of array of generic collections

If you want to declare IObsColDoor variables, and use them in foreach, you need to inherit IObsColDoor from IEnumerable:

public interface IObsColDoor : IEnumerable { }

Since ObsColDoor<T> is an ObservableCollection<T>, you don’t need to implement IEnumerable in ObsColDoor<T> class, because it is already implemented.

Note, that:

  • since IObsColDoor have not any generic functionality, you have to use IEnumerable instead of IEnumerable<T>
  • any other implementations of IObsColDoor must implement IEnumerable too.

Browse More Popular Posts

Leave a Comment