I have a generic class that uses a type parameter
public class CustomClass<T>
and I use it with type ObservableCollection<someClass> . All I want is to force this class to implement the IEnumerable interface, so I did the following:
public class CustomClass<T> : IEnumerable
The compiler complains:
Cannot apply indexing with [] to an expression of type 'T'
I understand that something is wrong there, but I donβt know how to accomplish what I want, which finally must succeed
public class CustomClass<T>
a
public class CustomClass<T> : IEnumerable
source share