zoukankan      html  css  js  c++  java
  • 数组集合

    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace ConsoleApplication2
    {
    class Program
    {
    static void Main(string[] args)
    {
    //int[] arr1 = new int[2] {1,2};
    //int[,] arr2 = new int[2, 3] {
    // {0,1,2 },
    // {2,3,4 }a
    // };

    //Console.WriteLine(arr2[1,1]);

    //ArrayList
    //ArrayList alt = new ArrayList();
    //alt.Add("123");
    //alt.Add(123);
    //alt.Add(true);
    //bool iscontain = alt.Contains("1");
    //alt.Clear();
    /*alt.Insert(0, "abc")*/;
    //Console.WriteLine(iscontain);

    //for(int i = 0; i < alt.Count; i++)
    //{
    // Console.WriteLine(alt[i].ToString() + " " + alt[i].GetType().ToString());
    //}

    //foreach (var x in alt)
    //{
    // Console.WriteLine(x.ToString() + " " + x.GetType().ToString());
    //}

    //泛型集合 List
    //List<string> str_list = new List<string>();
    //str_list.Add("a");
    //str_list.Add("b");
    //str_list.Add("c");
    //str_list.Add("d");

    //foreach(string x in str_list)
    //{
    // Console.WriteLine(x);
    //}


    //哈希表hashtable

    //Hashtable ht = new Hashtable();
    //ht.Add("1","a");
    //ht.Add(2, "b");
    //ht.Add(3, false);
    //ht.Add("x", 3.14);
    //Console.WriteLine(ht[2]);
    //foreach(var x in ht.Keys)
    //{
    // Console.WriteLine(ht[x]);
    //}

    //字典表 Dictionary

    //Dictionary<string, int> dic = new Dictionary<string, int>();
    //dic.Add("a", 3);
    //dic.Add("b", 4);
    //dic.Add("c", 5);
    //dic.Add("d", 6);
    //dic.Add("e", 7);

    //foreach(var x in dic.Keys)
    //{
    // Console.WriteLine(x);
    //}

    //队列 queue

    //Queue que = new Queue();
    //que.Enqueue("张三");
    //que.Enqueue("李四");
    //que.Enqueue("王五");
    //que.Enqueue("赵六");
    //Console.WriteLine("现在的长度是" + que.Count);
    //Console.WriteLine(que.Dequeue());
    //Console.WriteLine("现在的长度是" + que.Count);

    //堆栈 stack

    Stack st = new Stack();
    st.Push("a");
    st.Push("b");
    st.Push("c");
    st.Push("d");

    Console.WriteLine(st.Count);
    Console.WriteLine(st.Pop());
    Console.WriteLine(st.Count);

    Console.ReadLine();

    }
    }

    }

  • 相关阅读:
    IDEA 编译时 未结束的字符串文字
    JAVA文件下载,页面显示另存为效果
    no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
    【转】修改LINUX时间
    【转】tomcat7性能调优
    【转】Nginx中upstream有以下几种方式:
    【转】tomcat性能调优
    【转】Memcached安装
    【转】 linux下的g++编译器安装
    【转】nginx+tomcat+memcached (msm)实现 session同步复制
  • 原文地址:https://www.cnblogs.com/qwer123666/p/6993760.html
Copyright © 2011-2022 走看看