C 中遍歷Hashtable的4種方法

2022-10-04 11:33:09 字數 648 閱讀 3063

直接上**,**中使用四種方法遍歷hashtable。

using system;

using system.cwww.cppcns.comollections;

namespace hashtableexample

console.writeline("---");

//遍歷方法二:遍歷雜湊表中的值

foreach(string value in hashtable.values)

console.writeline("--------------------");

//遍歷方法三:遍歷雜湊表中的鍵值

foreach (dictionaryentry de in hashtable)

console.writeline("--------------------");

//遍歷方法四:遍歷雜湊表中的鍵值

idictionaryenumerator myenumwww.cppcns.comerator = hashtable.getenumerator();

whwww.cppcns.comile (myenumerator.movenext())}}}

下面是**的執行結果。

本文標題: c#中遍歷hashtable的4種方法

本文位址:

C 中Hashtable的遍歷辦法

c 中hashtable的遍歷辦法system.collect ions.hashtable 是用來表示一組組key value結構的容器,可能別的語言會把它叫做map,dictionary,其結構中key用來快速查詢,所以,叫它dictionary可能更加合適。hashtable的方法 屬性並不多...

C 中HashTable的用法

c 中hashtable的用法 一,雜湊表 hashtable 簡述 在.net framework中,hashtable是system.collections命名空間提供的乙個容器,用於處理和表現類似keyvalue的鍵值對,其中key通常可用來快速查詢,同時key是區分大小寫 value用於儲存...

C 中HashTable的用法

一,雜湊表 hashtable 簡述 在.net framework中,hashtable是system.collections命名空間提供的乙個容器,用於處理和表現類似keyvalue的鍵值對,其中key通常可用來快速查詢,同時key是區分大小寫 value用於儲存對應於key的值。hashtab...