A
Andy Chen
Hi,
I have a Hashtable, key is string and value is ArrayList. The problem is I
cannot cast the value from object to ArrayList.
like this:
Hashtable ht = new Hashtable();
ArrayList al = new ArrayList();
al.Add("test");
ht.Add("key1", al);
ArrayList al1 = (ArrayList)(Hashtable["key1"]; // .
The result of al1 is a ArrayList which has 1 item. al1[0] was a string value
"system.collections.arraylist", and there is no cast exception throwed.
What's the problem?
Thanks!
Andy
I have a Hashtable, key is string and value is ArrayList. The problem is I
cannot cast the value from object to ArrayList.
like this:
Hashtable ht = new Hashtable();
ArrayList al = new ArrayList();
al.Add("test");
ht.Add("key1", al);
ArrayList al1 = (ArrayList)(Hashtable["key1"]; // .
The result of al1 is a ArrayList which has 1 item. al1[0] was a string value
"system.collections.arraylist", and there is no cast exception throwed.
What's the problem?
Thanks!
Andy