How do I implement a generic stack in C#? -


I am using an example of Visual C # to use an RPN calculator to use the stack. The problem is that I do not know how to do it. I'm using System.Collections.Generic, but

  stack & lt; Double & gt; S = new stack & lt; Double & gt; ();  

Generates error:

Type 1 argument to use 'System.Collections.Generic.Stack' is required.

I'm not very clear here, thanks for the help.

try it

  stack & lt; Int & gt; S = new stack & lt; Int & gt; ();  

Change the int with whatever you're stacking in the stack.


Comments