GMMorris Posted October 8, 2004 Posted October 8, 2004 Hi, I've encountered a really strange thing. I have this code: m_sFilename = Dict.ChildKeys["Filename"].ToString(); which basicaly places the value of the string object stored in the Dict.ChildKeys hashtable into the string variable m_sFilename. The problem is, the expression Dict.ChildKeys["Filename"] returns null, and so m_sFilename now contains an empty string. The thing is, that I then tried explicitly telling the interpreter that the "ChildKeys" property returns a hashtable (see code below) and now it returns the correct value of the object stored in the hashtable. m_sFilename = ((System.Collections.Hashtable)(Dict.ChildKeys))["Filename"].ToString(); Any ideas why this would happen? I can leave my Sourcecode like in the lower code example, but that isn't as readable and is ugly. Any ideas? Quote Latly it would seem as though I'm don't abnegate from anything... except women. :( :)
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.