Skip to content

Entity.Get.FieldType.(String, ForgeTypeId)

Public Class

Retrieves the value of the field in the entity.

Namespace: Autodesk.Revit.DB.ExtensibleStorage

Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)

Syntax

public FieldType Get<FieldType>(
string fieldName,
ForgeTypeId unitTypeId
)

Parameters

fieldNameString

The name of the field to retrieve.

unitTypeId ForgeTypeId

Identifier of the unit 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

Return Value

FieldType

Exceptions

Exception

Condition


ArgumentNullException

A non-optional argument was NULL


InvalidOperationException

The Field belongs to a different Schema from this Entity, or this Entity is invalid.


ArgumentException

Requested type does not match the field type.


ArgumentException

The name matches no field in this Entity’s Schema.


ArgumentException

The unitTypeId value is not compatible with the field description.


ArgumentException

This field’s subschema prevents reading.


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.