当前位置:编程学习 > C#/ASP.NET >>

c# Stack操作类

Stack类代码:

01 using System;
02 //using System.Collections.Generic;
03 using System.Text;
04 using System.Collections;
05   
06 namespace StackHelper
07 {
08     class StackHelper
09     {
10         private Stack list;
11         public Stack List
12         {
13             set { list = value; }
14             get { return list; }
15         }
16         public StackHelper()
17         {
18             list = new Stack();//注意:不是list=new StackHelper()
19             Console.WriteLine("---------Stack-----------");
20         }
21         //压入一个元素
22         public void Add(object o)
23         {
24             list.Push(o);
25             Console.WriteLine("压入 元素:{0}",o);
26         }
27         //删除栈顶元素
28 &n
补充:软件开发 , C# ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,