Definition.GetDataType Method

DefinitionGetDataType Method

Gets a ForgeTypeId identifying the data type describing values of the parameter.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public ForgeTypeId GetDataType()
Public Function GetDataType As ForgeTypeId
public:
ForgeTypeId^ GetDataType()
member GetDataType : unit -> ForgeTypeId 

Return Value

ForgeTypeId
A ForgeTypeId identifying the data type of the parameter or an empty ForgeTypeId.
Remarks
The returned ForgeTypeId may be empty or may identify either a spec or a category. When it is a category, it indicates a Family Type parameter of that category. See Parameter.IsSpec(ForgeTypeId), UnitUtils.IsMeasurableSpec(ForgeTypeId), Category.IsBuiltInCategory(ForgeTypeId), and Parameter.IsValidDataType(ForgeTypeId). Some built-in parameters, such as those for color or level, have special data types which are not available for use with user-defined parameters and which have no representation in the Revit user interface or API. For these built-in parameters, this method returns an empty ForgeTypeId instance.
Example
//Find parameter using the Parameter's definition data type.
public Parameter FindParameter(Element element)
{
    Parameter foundParameter = null;
    // This will find the first parameter that measures length
    foreach (Parameter parameter in element.Parameters)
    {
        if (parameter.Definition.GetDataType() == SpecTypeId.Length)
        {
            foundParameter = parameter;
            break;
        }
    }
    return foundParameter;
}
'Find parameter using the Parameter's definition data type.
Public Function FindParameter(element As Element) As Parameter
    Dim foundParameter As Parameter = Nothing
    ' This will find the first parameter that measures length
    For Each parameter As Parameter In element.Parameters
        If parameter.Definition.GetDataType() = SpecTypeId.Length Then
            foundParameter = parameter
            Exit For
        End If
    Next
    Return foundParameter
End Function

No code example is currently available or this language may not be supported.

No code example is currently available or this language may not be supported.

See Also