ElementId
The ElementId object is used as a unique identification for an element within a single project.
Inheritance Hierarchy
System.Object
Autodesk.Revit.DB.ElementId
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public class ElementId
The ElementId type exposes the following members.
Constructors
Name
Description
Public Method
ElementId(BuiltInCategory)
Create an ElementId handle with the given BuiltInCategory id.
Public Method
ElementId(BuiltInParameter)
Create an ElementId handle with the given BuiltInParameter id.
Public Method
ElementId(Int32)
Obsolete.
Create an ElementId handle with the given 32-bit integer id.
Public Method
ElementId(Int64)
Create an ElementId handle with the given 64-bit integer id.
Properties
Name
Description
Public Property
IntegerValue
Obsolete.
Provides the value of the element id as a 32-bit integer.
Public Property
Static Member
InvalidElementId
Get the invalid ElementId whose value is -1.
Public Property
Value
Provides the value of the element id as a 64-bit integer.
Methods
Name
Description
Public Method
Compare
Compares two element ids.
Public Method
Equals
Determines whether the specified Object is equal to the current Object.
(Overrides Object.Equals(Object))
Public Method
GetHashCode
Gets the value of the id as hash code
(Overrides Object.GetHashCode.)
Public Method
GetType
Gets the Type of the current instance.
(Inherited from Object)
Public Method
Static Member
Parse
Parse the string representation of the id into a corresponding ElementId.
Public Method
ToString
Gets a String representation of the value of the id.
(Overrides Object.ToString.)
Public Method
Static Member
TryParse
Parse the string representation of the id into a corresponding ElementId.
Operators
Name
Description
Public Operator
Static Member
Equality(ElementId, ElementId)
Determines whether these two ElementIds are the same.
Public Operator
Static Member
GreaterThan(ElementId, ElementId)
Determines whether one element id is greater than another element id.
Public Operator
Static Member
GreaterThanOrEqual(ElementId, ElementId)
Determines whether one element id is not less than another element id.
Public Operator
Static Member
Inequality(ElementId, ElementId)
Determines whether these two ElementIds are different.
Public Operator
Static Member
LessThan(ElementId, ElementId)
Determines whether this element id is less than another element id.
Public Operator
Static Member
LessThanOrEqual(ElementId, ElementId)
Determines whether one element id is not greater than another element id.
Remarks
The Value within the ElementId is only unique with a single project. It is not unique across several projects. The Id can be used to retrieve a specific element from the database when needed. However ids are subject to change during an Autodesk Revit session and as such should not be retained and used across repeated calls to external commands. If a manner is needed to uniquely identify an element beyond this limitation then a shared parameter should be added to the element containing a unique identifier managed by the external application.