C# - 扩展堆栈类 - 错误

0 c#

我收到一个错误:"非泛型类型`System.Collections.Stack'不能与类型参数一起使用"

    // For use in BONUS section of lab:
    class LossyStack<T> : Stack<T> {
 private const int getAway=1;  // Starts out at 1 (out of 20 random numbers - 5%)
    public Stack<string> escsaped;

    public LossyStack(): base() {   // Constructor
        escaped = new Stack<string>();
    }

    public T Pop() {
  RandomNumber rand = new RandomNumber(1,20);  // One to twenty 

  if (rand<=getAway){
      escaped.push(base.Pop());
  }
  else {
        return base.Pop();
  }
  getAway++; // add another 1 to getAway so it increases by 5%
    }
  }
Run Code Online (Sandbox Code Playgroud)

谁能告诉我怎么能解决这个问题?谢谢一堆.

Tim*_*ter 6

更换:

使用System.Collections;

使用System.Collections.Generic;