AsValueString Method


Get the parameter value as a string with units.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.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 (ParameterType.YesNo
                                == attribute.Definition.ParameterType)
            {
                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 ParameterType.YesNo = attribute.Definition.ParameterType 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 Desktop

Put AI to work inside Revit.

Give Desktop your instructions and project files to build Revit families, update model elements, and create views and schedules. Works directly in Revit and AutoCAD.

Explore Desktop →