Click or drag to resize

SmartFoxGetRoomById Method

Retrieves a Room object from its id.

Namespace:  Sfs2X
Assembly:  SmartFox2X (in SmartFox2X.dll) Version: (1.7.11)
public Room GetRoomById(
	int id


Type: SystemInt32
The id of the Room.

Return Value

Type: Room
An object representing the requested Room; null if no Room object with the passed id exists in the Rooms list.
The same object is returned by the IRoomManager.getRoomById() method, accessible through the RoomManager getter; this was replicated on the SmartFox class for handy access due to its usually frequent usage.
The following example retrieves a Room object and writes its name:
int roomId = 3;
Room room = sfs.GetRoomById(roomId);
Console.WriteLine("The name of Room " + roomId + " is " + room.Name);                       // .Net / Unity
System.Diagnostics.Debug.WriteLine("The name of Room " + roomId + " is " + room.Name);      // UWP
See Also