Hi,
I have created a collection of a custom class. Everything works fine (can add these items in a combo from within a VB.NET application, for instance), but when looking at the collection from a VB.NET application in the Watch window, I cannot see the items of the collection. The message in the Watch window's "value" says: "<cannot view indexed property>." Below is the code I wrote.
Any idea of what is wrong? Or is the error message "correct"?
Thanks a lot.
Mike
public class Companies : IEnumerable {
ArrayList m_oCompanies = null;
public Companies() { // Nothing is done in the constructor. }
public void Add(Company oCompany) {...}
public Company this[int index] {
get { return (Company)m_oCom panies[index]; }
}
public int Count { ... }
}
public IEnumerator GetEnumerator() { return new CompaniesEnumer ator(m_oCompani es); }
// Inner class implements IEnumerator interface:
class CompaniesEnumer ator : IEnumerator {
int index;
ArrayList m_oCompanies;
public CompaniesEnumer ator(ArrayList oCompanies) { this.m_oCompani es = oCompanies; }
public bool MoveNext() { return (++index < m_oCompanies.Co unt); }
public object Current {
get {
if (index < m_oCompanies.Co unt) return m_oCompanies[index];
else
return null; }
}
public void Reset() { ... }
Comment