Entity.Set<FieldType>(Field, FieldType) Method

EntitySetFieldType(Field, FieldType) Method

Stores the value of the field in the entity.

Namespace: Autodesk.Revit.DB.ExtensibleStorage
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.3.0.0 (25.3.0.0)
Syntax
public void Set<FieldType>(
	Field field,
	FieldType value
)
Public Sub Set(Of FieldType) ( 
	field As Field,
	value As FieldType
)
public:
generic<typename FieldType>
void Set(
	Field^ field, 
	FieldType value
)
member Set : 
        field : Field * 
        value : 'FieldType -> unit 

Parameters

field  Field
The field to update.
value  FieldType
 

Type Parameters

FieldType
The type of the field
Exceptions
ExceptionCondition
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 For floating-point fields, use the overload taking a ForgeTypeId parameter.
ArgumentException This field's subschema prevents writing.
ArgumentException Invalid floating-point value.
ArgumentException String is too long; exceeds max length of 16mb characters.
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.

Note that when string values are specified as map keys, they are case-insensitive.

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.

See Also