G
Guest
Here is the definition for System.Collection.ObjectModel.Collection generic
class:
[SerializableAttribute]
[ComVisibleAttribute(false)]
public class Collection<T> : IList<T>, ICollection<T>,
IEnumerable<T>, IList, ICollection, IEnumerable
The class does not support IEnumerator or IEnumerator<T> interfaces. How
come I can still use "foreach" against the class? I think a class has to
support IEnumerable and IEnumerator for "foreach". Anyone can tell me the
reason? I need to implement a class similar to it (can not derive from it in
my case).
class:
[SerializableAttribute]
[ComVisibleAttribute(false)]
public class Collection<T> : IList<T>, ICollection<T>,
IEnumerable<T>, IList, ICollection, IEnumerable
The class does not support IEnumerator or IEnumerator<T> interfaces. How
come I can still use "foreach" against the class? I think a class has to
support IEnumerable and IEnumerator for "foreach". Anyone can tell me the
reason? I need to implement a class similar to it (can not derive from it in
my case).