ElementSet Class


A set that contains element objects.

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

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

See Also