new Stack() : Stack « System.Collections.Generic « C# / C Sharp by API






new Stack()

 

using System;        
using System.Collections.Generic;



class MainClass
{
    public static void Main(string[] args)
    {
        Stack<MyClass> stack = new Stack<MyClass>();

        stack.Push(new MyClass());

        MyClass ass3 = stack.Pop();

        Console.WriteLine("\nPopped from stack: {0}", ass3);

    }
}
class MyClass {
    
   public override string ToString(){
    
      return "my class";
   }
    
}

   
  








Related examples in the same category

1.Stack.Pop
2.Stack.Push