In C# 2, this works just fine:
public class foo : IEnumerable<str ing>
{
private string[] _list;
public IEnumerator<str ingGetEnumerato r()
{
foreach (string s in _list)
yield return s;
}
}
However Orcas complains that:
'myNS.foo' does not implement interface member
'System.Collect ions.IEnumerabl e.GetEnumerator ()'. 'myNS.foo.GetEn umerator()'
cannot implement 'System.Collect ions.IEnumerabl e.GetEnumerator ()' because it
does not have the matching return type of 'System.Collect ions.IEnumerato r'.
It appears that I'll have to add an explicit non-generic interface
implementation to appease the compiler:
IEnumerator IEnumerable.Get Enumerator()
{
return GetEnumerator() ;
}
Just wondering whether this is a change in generics implementation or just a
bug in beta 1.
Cheers,
Don
public class foo : IEnumerable<str ing>
{
private string[] _list;
public IEnumerator<str ingGetEnumerato r()
{
foreach (string s in _list)
yield return s;
}
}
However Orcas complains that:
'myNS.foo' does not implement interface member
'System.Collect ions.IEnumerabl e.GetEnumerator ()'. 'myNS.foo.GetEn umerator()'
cannot implement 'System.Collect ions.IEnumerabl e.GetEnumerator ()' because it
does not have the matching return type of 'System.Collect ions.IEnumerato r'.
It appears that I'll have to add an explicit non-generic interface
implementation to appease the compiler:
IEnumerator IEnumerable.Get Enumerator()
{
return GetEnumerator() ;
}
Just wondering whether this is a change in generics implementation or just a
bug in beta 1.
Cheers,
Don
Comment