How could I get the string value from a hashtable without calling toString() methode?
example: my class:
public class myHashT : Hashtable
{
public myHashT () { }
...
public override object this[object key]
{
get
{
return base[key].ToString(); <--this doesn't work!
}
set
{
base[key] = value;
}
}
}
In an other class:
myHashT hT;
string test = hT["someKey"];
it works with hT["someKey"].toString(); but I need it without calling ToString() and without casting to (string).
You could use System.Collections.Generic.HashSet. Alternately use composition instead of inheritance ie. have hashtable be your private field and write your own indexer that does ToString().
}