ElementSet Class


A set that contains element objects.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 21.0.0.0 (21.1.1.109)

Syntax

C#
public class ElementSet : APIObject, IEnumerable
Visual Basic
Public Class ElementSet _
	Inherits APIObject _
	Implements IEnumerable
Visual C++
public ref class ElementSet : public APIObject, 
	IEnumerable

Examples

Copy C#
ICollection<ElementId> selectedIds = uidoc.Selection.GetElementIds();

string info = "Selected elements:\n";
foreach (ElementId id in selectedIds)
{
    Element elem = document.GetElement(id);
    info += elem.Name + "\n";
}

TaskDialog.Show("Revit",info);
Copy VB.NET
Dim selectedIds As ICollection(Of ElementId) = uidoc.Selection.GetElementIds()

Dim info As String = "Selected elements:" & vbLf
For Each id As ElementId In selectedIds
    Dim elem As Element = document.GetElement(id)
    info += elem.Name + vbLf
Next

TaskDialog.Show("Revit", info)

Inheritance Hierarchy

System Object
Autodesk.Revit.DB APIObject
Autodesk.Revit.DB ElementSet

See Also