Get(FieldType) Method (String, DisplayUnitType)


Retrieves the value of the field in the entity.

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

Syntax

C#
[ObsoleteAttribute("This method is deprecated in Revit 2021 and may be removed in a future version of Revit. Please use the `Get(string, ForgeTypeId)` overload instead.")]
public FieldType Get<FieldType>(
	string fieldName,
	DisplayUnitType displayUnits
)
Visual Basic
<ObsoleteAttribute("This method is deprecated in Revit 2021 and may be removed in a future version of Revit. Please use the `Get(string, ForgeTypeId)` overload instead.")> _
Public Function Get(Of FieldType) ( _
	fieldName As String, _
	displayUnits As DisplayUnitType _
) As FieldType
Visual C++
[ObsoleteAttribute(L"This method is deprecated in Revit 2021 and may be removed in a future version of Revit. Please use the `Get(string, ForgeTypeId)` overload instead.")]
public:
generic<typename FieldType>
FieldType Get(
	String^ fieldName, 
	DisplayUnitType displayUnits
)

Parameters

fieldName
Type: System String
The name of the field to retrieve.
displayUnits
Type: Autodesk.Revit.DB DisplayUnitType
The units to which the value will be converted before returning. Must be compatible with the spec specified when creating the Schema.

Type Parameters

FieldType
The type of the field

Remarks

The template parameter must match the type of the field (specified when creating the Schema) exactly; this method does not perform data type conversions. The types for containers are IList for arrays and IDictionary for maps.

This method is a shortcut that will look up the field by name. If you want to call it on many entities, it is faster if you look up the field yourself.

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was NULL
Autodesk.Revit.Exceptions InvalidOperationException The Field belongs to a different Schema from this Entity, or this Entity is invalid.
Autodesk.Revit.Exceptions ArgumentException Requested type does not match the field type.
Autodesk.Revit.Exceptions ArgumentException The name matches no field in this Entity's Schema.
Autodesk.Revit.Exceptions ArgumentException The displayUnits value is not compatible with the field description.
Autodesk.Revit.Exceptions ArgumentException This field's subschema prevents reading.

See Also