GetAllElementsOfClass

IEnumerable<T> GetAllElementsOfClass<T>(this Document doc) where T : Element

Collects all elements of a given Revit element class T.

Parameters

  • docDocument

    The Revit document instance.

Returns: A collection of elements of type T (empty if document is null or none found).

Example

foreach (var level in doc.GetAllElementsOfClass<Level>())
{
TaskDialog.Show("Level", level.Name);
}