タグ

関連タグで絞り込む (1)

タグの絞り込みを解除

hashtableに関するtaku2009のブックマーク (1)

  • Hashtableのforeach:Gushwell's Dev Notes

    Hashtable で foreach を使おうと思ったら、やり方が分からない。でもって、調べてみました。2つやり方があるようです。 一つは、DirectoryEntryクラスのインスタンスを取り出す方法。 Hashtable ht = new Hashtable(); ht.Add("HP","Hewlett-Packard"); ht.Add("MS","Microsoft"); ht.Add("CA","Computer Associates"); foreach ( DictionaryEntry d in ht ) { listBox1.Items.Add(d.Key + " : " + d.Value); } もう一つは、Keys プロパティを使う方法。 foreach (string name in ht.Keys) { listBox1.Items.Add(name + "

  • 1