Stores the value of the field in the entity.
Namespace: Autodesk.Revit.DB.ExtensibleStorageAssembly: 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 `Set(Field, FieldType, ForgeTypeId)` overload instead.")] public void Set<FieldType>( Field field, FieldType value, 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 `Set(Field, FieldType, ForgeTypeId)` overload instead.")> _ Public Sub Set(Of FieldType) ( _ field As Field, _ value As FieldType, _ displayUnits As DisplayUnitType _ ) |
Visual C++ |
---|
[ObsoleteAttribute(L"This method is deprecated in Revit 2021 and may be removed in a future version of Revit. Please use the `Set(Field, FieldType, ForgeTypeId)` overload instead.")] public: generic<typename FieldType> void Set( Field^ field, FieldType value, DisplayUnitType displayUnits ) |
Parameters
- field
- Type: Autodesk.Revit.DB.ExtensibleStorage..::..Field
The field to update.
- value
- Type: FieldType
- displayUnits
- Type: Autodesk.Revit.DB..::..DisplayUnitType
The units from which the value will be converted before storing. 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 only modifies your copy of the Entity. Store the Entity in an element or another Entity to save the new value. Write access check is not performed on each call to Set. Instead, write access is checked when you try to save the Entity in an Element or another Entity.
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 displayUnits value is not compatible with the field description. |
Autodesk.Revit.Exceptions..::..ArgumentException | This field's subschema prevents writing. |
Autodesk.Revit.Exceptions..::..ArgumentException | Invalid floating-point value. |