AsValueString Method


Get the parameter value as a string with units.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 22.0.0.0 (22.1.0.0)

Syntax

C#
public string AsValueString()
Visual Basic
Public Function AsValueString As String
Visual C++
public:
String^ AsValueString()

Return Value

The string that represents the parameter value.

Examples

Copy C#
String ShowValueParameterInformation(Parameter attribute)
{
    string paramValue = null;
    switch (attribute.StorageType)
    {
        case StorageType.Integer:
            if (SpecTypeId.Boolean.YesNo
                                == attribute.Definition.GetDataType())
            {
                paramValue = null;
            }
            else
            {
                paramValue = attribute.AsValueString();
            }
            break;
        case StorageType.Double:
            paramValue = attribute.AsValueString();
            break;
        default:
            paramValue = null;
            break;
    }

    return paramValue;
}
Copy VB.NET
Private Function ShowValueParameterInformation(attribute As Parameter) As [String]
    Dim paramValue As String = Nothing
    Select Case attribute.StorageType
        Case StorageType.[Integer]
            If SpecTypeId.Boolean.YesNo = attribute.Definition.GetDataType() Then
                paramValue = Nothing
            Else
                paramValue = attribute.AsValueString()
            End If
            Exit Select
        Case StorageType.[Double]
            paramValue = attribute.AsValueString()
            Exit Select
        Case Else
            paramValue = Nothing
            Exit Select
    End Select

    Return paramValue
End Function

See Also

ArchiLabs

Stop fighting Revit automation.

Build repeatable BIM design and documentation workflows with scripts, data, and AI in one place, without wrestling brittle one-off automations.

Try ArchiLabs →