G
Gustaf
Using VS 2005. I got an 'IpForm' class and an 'IpFormCollection' class,
containing IpForm objects. To iterate through IpFrom objects with
foreach, the class is implemented as such:
public class IpFormCollection : IEnumerable<IpForm>
{
ArrayList forms = new ArrayList();
public IEnumerator<IpForm> GetEnumerator()
{
foreach (IpForm f in this.forms)
{
yield return f;
}
}
...
}
From what I learned here
http://www.ondotnet.com/pub/a/dotnet/2004/06/07/liberty.html
this ought to work, but VS says that the class "does not implement
interface member 'System.Collections.IEnumerable.GetEnumerator()'." and
that "GetEnumerator()' is either static, not public, or has the wrong
return type."
Gustaf
containing IpForm objects. To iterate through IpFrom objects with
foreach, the class is implemented as such:
public class IpFormCollection : IEnumerable<IpForm>
{
ArrayList forms = new ArrayList();
public IEnumerator<IpForm> GetEnumerator()
{
foreach (IpForm f in this.forms)
{
yield return f;
}
}
...
}
From what I learned here
http://www.ondotnet.com/pub/a/dotnet/2004/06/07/liberty.html
this ought to work, but VS says that the class "does not implement
interface member 'System.Collections.IEnumerable.GetEnumerator()'." and
that "GetEnumerator()' is either static, not public, or has the wrong
return type."
Gustaf