Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 编程语言 > .NET > C#.NET > C#实现的环形双向链表
【标  题】:C#实现的环形双向链表
【关键字】:C#
【来  源】:http://blog.csdn.net/city22/archive/2006/07/21/955701.aspx

C#实现的环形双向链表

Your Ad Here

 public class Chain
    {
        //Chain proporty
        public string ID;
        public string name;
        public string text;
        public DateTime time;

        //Chain relation
        private object lastObj;
        private object nextObj;

        public object Next
        {
            get{return nextObj;}
            set{nextObj=value;}
        }
        public object Previous
        {
            get{return lastObj;}
            set{this.lastObj=value;}
        }

        public Chain(){}
    }

 


    public class ChainManager
    {
        int count;
        Chain current;

        public ChainManager(int num)
        {
            Chain fristChain = new Chain();
            Chain chain = fristChain;

            for (int i = 0; i < num-1; i++)
            {
                //chain property
                chain.name = i.ToString();

                //chain relation
                Chain newChain=new Chain();
                chain.Next = newChain;
                newChain.Previous = chain;
                chain = (Chain)chain.Next;
            }
            chain.name = "9";
            chain.Next = fristChain;
            fristChain.Previous = chain;

            this.current = chain;
            this.count = num;
        }

        public void Next()
        {
            current=(Chain)current.Next;
        }
        public void Previous()
        {
            current=(Chain)current.Previous;
        }
        public Chain CurrentChain
        {
            get { return current; }
            set { current = value; }
        }
        public int Count
        {
            get { return count; }
        }
    }

 

为了实现自己的一个固定空间的管理器,在某些特殊的情况下还是比较有用的

asp.net如何编写自定义控件:【上一篇】
c#socket编程:【下一篇】
【相关文章】
  • 一个遍历C#中多维数组的函数(不太菜的菜鸟级)
  • 使用C#調用外部程式或是執行DOS命令
  • C# winform中不规则窗体制作的解决方案(已经解决24位色以上不能正常显示问题)
  • C#目录遍历
  • C#数据库操作的3种典型用法
  • C#.net常用函数和方法集汇总
  • C# 输入法切换类
  • C#技术杂谈
  • 使用C# post数据
  • c# 用System.Net 读取网页源代码
  • 【随机文章】
  • sql注入
  • 最大的相同字符子串
  • j2me学习中的问题(逐渐添加中)
  • 禁止master扩展存储过程xp_cmdshell命令
  • 函数申明__p的用法
  • 龙芯系列的后续发展 zt(在网上找的,希望是真的)
  • 为需要动态分配内存的类声明自己的拷贝构造函数和赋值操作符(Effective C++条款11)
  • 忽略MOSPFLSA包
  • 基于eclipse JDT的UML模型和Java的双向同步
  • 《给初学者的Windows Vista的补遗手册》之072
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 软讯网络 All Rigths Reserved.