c# - Hashtable new entries permanent loop and finding key with lowest value -
c# - Hashtable new entries permanent loop and finding key with lowest value -
string v; int k; console.writeline("enterv"); v = console.readline(); console.writeline("enter k"); k = int.parse(console.readline()); ht.add(v, k);
this code , have in function never ends, why that??
and also, i'm trying find lowest key in hash table, , professor gave illustration can't work.
hashtable tabela=new hashtable(); string ime; int min=100000; foreach(string k in tabela) { if(tabela[k]<min){ min=tabela[k]; ime=k; } }
how can compare keys properly?
var minvalue = int32.maxvalue; string minkey = null; foreach (dictionaryentry item in ht) { if ((int) item.value < minvalue) { minvalue = (int) item.value; minkey = (string) item.key; } }
c# .net hashtable
Comments
Post a Comment