M
Mujtaba Syed
I have the Nov '04 CTP of .NET 2.0 (The splash screen of Visual Studio .NET
calls it Beta 2).
I was trying some simple iterator code...
using System.Collections.Generic;
public class CityCollection : IEnumerable<string>
{
string[] m_Cities = {"New York","Paris","London"};
public IEnumerator<string> GetEnumerator()
{
for(int i = 0; i<m_Cities.Length; i++)
yield return m_Cities;
}
}
And I am getting a compile-time error:
test.cs(3,14): error CS0536: 'CityCollection' does not implement interface
member 'System.Collections.IEnumerable.GetEnumerator()'.
'CityCollection.GetEnumerator()' is either static, not public, or
has
the wrong return type.
c:\WINDOWS\Microsoft.NET\Framework\v2.0.41202\mscorlib.dll: (Location of
symbol
related to previous error)
test.cs(6,31): (Location of symbol related to previous error)
This code used to work in Beta 1! What's the problem?
Thanks,
Mujtaba.
calls it Beta 2).
I was trying some simple iterator code...
using System.Collections.Generic;
public class CityCollection : IEnumerable<string>
{
string[] m_Cities = {"New York","Paris","London"};
public IEnumerator<string> GetEnumerator()
{
for(int i = 0; i<m_Cities.Length; i++)
yield return m_Cities;
}
}
And I am getting a compile-time error:
test.cs(3,14): error CS0536: 'CityCollection' does not implement interface
member 'System.Collections.IEnumerable.GetEnumerator()'.
'CityCollection.GetEnumerator()' is either static, not public, or
has
the wrong return type.
c:\WINDOWS\Microsoft.NET\Framework\v2.0.41202\mscorlib.dll: (Location of
symbol
related to previous error)
test.cs(6,31): (Location of symbol related to previous error)
This code used to work in Beta 1! What's the problem?
Thanks,
Mujtaba.