Description
To get all rooms in Revit, you may first try to filter elements by Room type, however this will yield no results. Instead you will have to check against SpatialElement type and check if it's a room.
Solution
csharp
FilteredElementCollector filteredElementCollector
= new FilteredElementCollector(aDocument);
filteredElementCollector.OfClass(typeof(SpatialElement));
IList<Room> m_RoomList = new List<Room>();
foreach (SpatialElement room in filteredElementCollector)
if (room is Room)
m_RoomList.Add((Room)room);