Click or drag to resize

SmartFoxGetRoomByName Method

Retrieves a Room object from its name.

Namespace:  Sfs2X
Assembly:  SmartFox2X (in SmartFox2X.dll) Version: 1.8.0.0 (1.8.0)
Syntax
C#
public Room GetRoomByName(
	string name
)

Parameters

name
Type: SystemString
The name of the Room.

Return Value

Type: Room
An object representing the requested Room; null if no Room object with the passed name exists in the Rooms list.
Remarks
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.
Examples
The following example retrieves a Room object and writes its id:
string roomName = "The Lobby";
Room room = sfs.GetRoomByName(roomName);
Console.WriteLine("The id of Room '" + roomName + "' is " + room.Id);                           // .Net / Unity
System.Diagnostics.Debug.WriteLine("The id of Room '" + roomName + "' is " + room.Id);          // UWP
See Also