zoukankan      html  css  js  c++  java
  • 7.30

    特殊技集合

    初始化 干草堆 stack集合
    先进后出,一个一个的赋值,一个一个的取值

    添加元素(推送)   push

    Console.WriteLine(ss.Count); 个数

    Console.WriteLine(ss.Pop());
    弹出

    clear 清空集合

    enqueue 进队列集合

    dequeue   出列队集合

    哈希表集合
    先进后出,一个一个赋值,但是只能一起取值
    初始化
    Hashtable ht = new Hashtable();
    ht.Add(1,"可口可乐");
    ht.Add(2, "雪碧");
    ht.Add(3, "百事可乐");
    ht.Add(4, "芬达");
    ht.Add(5, "美年达");
    移除(某个key值的位置的元素)
    ht.Remove(3);
    判断是否包含
    Console.WriteLine( ht.Contains(5));
    Console.WriteLine(ht.Count);
    foreach (int aa in ht.Keys)
    {
    Console.WriteLine(aa);
    }
    foreach (string ss in ht.Values)
    {
    Console.WriteLine(ss);
    }

    使用枚举类型来读取(表格样式)
    IDictionaryEnumerator ide = ht.GetEnumerator();
    while(ide.MoveNext())
    {
    Console.WriteLine(ide.Key+" "+ide.Value);
    }
    Console.ReadLine();

  • 相关阅读:
    group having条件找max无记录问题
    Apache Http Server
    Google产品
    AES加密报错Illegal key size
    内网调试微信开发
    试用VSCode
    React的Transaction浅析
    一个webpack,react,less,es6的DEMO
    20151128
    React生命周期浅析
  • 原文地址:https://www.cnblogs.com/power8023/p/5721311.html
Copyright © 2011-2022 走看看