惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
The Blog of Author Tim Ferriss
博客园 - 司徒正美
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
有赞技术团队
有赞技术团队
量子位
S
SegmentFault 最新的问题
博客园 - 聂微东
博客园 - 【当耐特】
J
Java Code Geeks
美团技术团队
Hugging Face - Blog
Hugging Face - Blog
H
Help Net Security
V
V2EX
人人都是产品经理
人人都是产品经理
博客园 - Franky
罗磊的独立博客
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell
云风的 BLOG
云风的 BLOG
Y
Y Combinator Blog
Apple Machine Learning Research
Apple Machine Learning Research

博客园 - light's cafe

BitVector32结构学习 转贴一篇关于BitVector32的Blog 依赖单元测试开发 调整过的书籍目录 今天晚上的遭遇 设计,UML,测试驱动开发 看牙记 我是LIGHT的LP,今天由我代笔 明天去买干粒猫粮 面向接口编程 关于测试驱动开发的文章 今天我只睡了三个小时 强命名程序集 我,我 庆祝一下 看兽医记 程序集文件中的版本号 AL链接器 怪事时时有不如昨天多
Queue和Stack的学习代码
light's cafe · 2004-08-23 · via 博客园 - light's cafe

using System;
using System.Collections;
using System.Windows.Forms;

namespace Lightsoftware
{
 #region <summary>
 /// <summary>
 ///
 /// </summary>
 #endregion
 public class MyClass: Object
 {
  public static void Main(String[] args)
  {
   TestQueue();
   TestStack();
  }

  private static void TestQueue()
  {
   Queue queue = new Queue();   
   queue.Enqueue(5);
   queue.Enqueue(7);
   queue.Enqueue(9);

   Int32 count = queue.Count;

   //output 5, 7, 9
   for (Int32 index = 0; index < count; ++index)
   {
    MessageBox.Show(((Int32)queue.Dequeue()).ToString());
   }
  }

  public static void TestStack()
  {
   Stack stack = new Stack();
   stack.Push(5);
   stack.Push(7);
   stack.Push(9);

   Int32 count = stack.Count;
   
   //output 9, 7, 5
   for (Int32 index = 0; index < count; ++index)
   {
    MessageBox.Show(((Int32)stack.Pop()).ToString());
   }
  }
 }
}