Page 1 of 1

Error in GetRoomList example?

Posted: 05 Jan 2009, 17:48
by jeff_o
In the example usage for GetRoomList:

SFSEvent.onRoomListUpdate += OnRoomListUpdate;

smartFox.GetRoomList()

public void OnRoomListUpdate(Hashtable roomList)
{
// Dump the names of the available rooms in the current zone
foreach (Room room in roomList)
Trace.WriteLine(room.GetName())
}

I get an error on the foreach line:

Unable to cast object of type 'System.Collections.DictionaryEntry' to type 'SmartFoxClientAPI.Data.Room'.

I am using version 1.0 final, any help with this would be much appreciated!

Posted: 05 Jan 2009, 18:52
by ThomasLund
Ahh yes - good one

Try roomList.Values in the foreach instead of just roomList

Will fix that in the next update. If you find any other examples with bad code then poke me here - most of them are not tested but written directly as comments.

Posted: 06 Jan 2009, 00:11
by jeff_o
Works, thanks =] I will let you know of any other errors I come across!