c# hashtable代码实例

public string getnumber(string mathnum)
        {

            Hashtable ht = new Hashtable();
            ht.Add("0", "零");
            ht.Add("1", "一");
            ht.Add("2", "二");
            ht.Add("3", "三");
            ht.Add("4", "四");
            ht.Add("5", "五");
            ht.Add("6", "六");
            ht.Add("7", "七");
            ht.Add("8", "八");
            ht.Add("9", "九");
            ht.Add("10", "十");
            foreach (DictionaryEntry objde in ht)
            {
                if (string.Compare(objde.Key.ToString(), mathnum) == 0)
                {
                    returnstr=objde.Value.ToString();
                    break;
                }
            }
            return returnstr;
        }

posted @ 2009-01-07 10:44  火精灵  阅读(392)  评论(0编辑  收藏  举报