zoukankan      html  css  js  c++  java
  • C#泛型

    class Program
        {
            static void Main(string[] args)
            {
                //string words = "1,2,3";

                //string[] split = words.Split(',');

                //foreach (string s in split)
                //{
                //    if (s.Trim() != "")
                //        Console.WriteLine(s);
                //}
                Stack<int> stack = new Stack<int>();
                stack.Push(17);
                foreach (int i in stack.Store) {
                    Console.WriteLine(i);
                }
                Console.ReadKey();
            }
        }

        class Stack<T> {
            private T[] store;
            public T[] Store
            {
                get { return store;}
                set { store = value; }
            }
            private int size;
            public Stack() {
                store = new T[10]; size = 0;
            }
            public void Push(T x) {
                store[size++] = x;
            }
            public T Pop() {
                return store[--size];
            }
        }

  • 相关阅读:
    django自带登录认证与登录自动跳转
    11月份草稿2
    使用JavaScript实现字符串格式化
    requests与BeautifulSoup
    python+minicap(二)
    python+minicap的使用
    python+opencv图像处理(一)
    haproxy实现mysql从库负载均衡
    mysql 5.7 64位 解压版安装
    Redis基础教程
  • 原文地址:https://www.cnblogs.com/mingle/p/1614375.html
Copyright © 2011-2022 走看看