A set that contains element objects.
Inheritance Hierarchy
System.ObjectAutodesk.Revit.DB.APIObject
Autodesk.Revit.DB.ElementSet
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.3.0.0 (25.3.0.0)
Syntax
C#
public class ElementSet : APIObject, IEnumerable
The ElementSet type exposes the following members.
Constructors
Name | Description | |
---|---|---|
![]() | ElementSet | Initializes a new instance of the ElementSet class |
Properties
Name | Description | |
---|---|---|
![]() | IsEmpty | Test to see if the set is empty. |
![]() ![]() | IsReadOnly | Identifies if the object is read-only or modifiable. (Inherited from APIObject) |
![]() | Size | Returns the number of elements that are in the set. |
Methods
Name | Description | |
---|---|---|
![]() | Clear | Removes every item element the set, rendering it empty. |
![]() | Contains | Tests for the existence of an element within the set. |
![]() | Dispose | Causes the object to release immediately any resources it may be utilizing. (Inherited from APIObject) |
![]() | Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) |
![]() | Erase | Removes a specified element from the set. |
![]() | ForwardIterator | Retrieve a forward moving iterator to the set. |
![]() | GetEnumerator | Retrieve a forward moving iterator to the set. |
![]() | GetHashCode | Serves as the default hash function. (Inherited from Object) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object) |
![]() | Insert | Insert the specified element into the set. |
![]() | ReverseIterator | Retrieve a backward moving iterator to the set. |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object) |
Example
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);
VB
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)