zoukankan      html  css  js  c++  java
  • 哈希表

    Hashtable在命名空间using System.Collections中,实现基于键值的查找很方便
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Collections;

    namespace 哈希表
    {
        
    class Program
        
    {
            
    static void Main(string[] args)
            
    {
                Hashtable table 
    = new Hashtable();
                Employee P1 
    = new Employee("1""li""21");
                Employee P2 
    = new Employee("2""zhang""22");
                table.Add(P1.ID, P1);
                table.Add(P2.ID, P2);


                
    foreach (object o in table.Keys)
                
    {
                    
    if (o == "1")
                    
    {
                        Console.WriteLine(((Employee)table[o]).ID);
                        Console.WriteLine(((Employee)table[o]).age);
                        Console.WriteLine(((Employee)table[o]).name);
                    }

                    
    {

                    }

                }


            }

            
    public struct Employee
            
    {
                
    public Employee(string a, string b, string c)
                
    {
                    ID 
    = a;
                    name 
    = b;
                    age 
    = c;
                }

                
    public string ID;
                
    public string name;
                
    public string age;
            }

        }

    }

    肩负责任,永不退缩
  • 相关阅读:
    IIS日志-网站运维的好帮手
    精选7款绚丽的HTML5和jQuery图片动画特效
    不错的东西
    【今日推荐】10大流行的 Metro UI 风格的 Bootstrap 主题和模板
    跨域使用jsonp 获取天气预报
    《JavaScript权威指南》读书笔记(三)
    css背景定位
    网页加载速度的优化
    CSS书写顺序
    《JavaScript权威指南》读书笔记(二)
  • 原文地址:https://www.cnblogs.com/ATP/p/860620.html
Copyright © 2011-2022 走看看