Без проблем:
class En : IEnumerable<string>
{
#region Члены IEnumerable<string>
public IEnumerator<string> GetEnumerator()
{
throw new NotImplementedException();
}
#endregion
#region Члены IEnumerable
IEnumerator IEnumerable.GetEnumerator()
{
throw new NotImplementedException();
}
#endregion
}
А здесь никак:
class En : IEnumerable[string]
{
#region System.Collections.IEnumerable Members
GetEnumerator() : System.Collections.IEnumerator
implements System.Collections.IEnumerable.GetEnumerator{ throw System.NotImplementedException() }
#endregion
#region System.Collections.Generic.IEnumerable[string] Members
GetEnumerator() : System.Collections.Generic.IEnumerator[string]
implements System.Collections.Generic.IEnumerable[string].GetEnumerator{ throw System.NotImplementedException() }
#endregion
}
error : attempted return type overload on method Test1.En.GetEnumerator() : System.Collections.Generic.IEnumerator[string] and method Test1.En.GetEnumerator() : System.Collections.IEnumerator
... << RSDN@Home 1.2.0 alpha 5 rev. 1539>>
Здравствуйте, nikov, Вы писали:
N>Здравствуйте, DarthSidius, Вы писали:
N>http://rsdn.ru/forum/nemerle/3745025.1.aspxАвтор: _nn_
Дата: 22.03.10
Понял, багу 2 года уже.
... << RSDN@Home 1.2.0 alpha 5 rev. 1539>>
Здравствуйте, DarthSidius, Вы писали:
DS>DS>error : attempted return type overload on method Test1.En.GetEnumerator() : System.Collections.Generic.IEnumerator[string] and method Test1.En.GetEnumerator() : System.Collections.IEnumerator
Да в шарпе как бы тоже нельзя метод с одним именем перегрузить по возвращаемому значению.
Тут нужно имя менять у одного из методов и реализовывать его явно.
private NonGenericGetEnum () : System.Collections.IEnumerator
implements System.Collections.IEnumerable.GetEnumerator
{
...
}
Но в твоем случае нужно просто грохнуть метод:
GetEnumerator() : System.Collections.IEnumerator
Немерл его сам реализует через дженерик-метод.