Hi Ray, With .NET Frameworks Beta 2 the behavior is exactly as you observe, however, I found that your code works as expected on the newest builds of .NET Frameworks, including the Visual Studio Release Candidate build available to MSDN subscribers.
Martin -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ray Djajadinata Sent: Sunday, September 25, 2005 6:28 AM To: users-ironpython.com@lists.ironpython.com Subject: [IronPython] Iterating over Dictionary<int, str> returns the wrong objects? Hello, I'm trying to print the contents of a Dictionary<int, string>. In C# I can do this: foreach (KeyValuePair<int, string> pair in myDict) { Console.WriteLine(pair.ToString()); } However, in IP, typing this: >>> myDict = Dictionary[int, str]() >>> # ... do stuff here ... >>> for pair in myDict: ... print str(pair) ... or this: >>> for pair in myDict: ... print pair.ToString() ... gives me this: System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry ... Instead of KeyValuePair<int, string> instances, I was getting DictionaryEntry-s instead, whose ToString() method indeed prints the fully qualified name of the instance (instead of anything meaningful). Is there a workaround or I should just wait for the fix? :) Thank you! Ray __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com _______________________________________________ users-ironpython.com mailing list users-ironpython.com@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users-ironpython.com mailing list users-ironpython.com@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com