C#:访问链表的反向枚举数
|
我为LinkedList创建了一个“反向itearator”,现在我想将其与扩展方法一起使用:
public static class LinkedListExtensionMethods
{
public static IEnumerator GetReverseEnumerator<T>(this LinkedList<T> linkedList)
{
return new LinkedListReverseEnumerator<T>(linkedList);
}
public static IEnumerator<T> GetReverseGenericEnumerator<T>(this LinkedList<T> linkedList)
{
return new LinkedListReverseEnumerator<T>(linkedList);
}
}
但是,如果我写:
foreach (ICommand command in _CompoundDoCollection.GetReverseEnumerator<ICommand>())
它不起作用。
我该怎么办?
没有找到相关结果
已邀请:
1 个回复
琳娘