Share

Parameter.AsValueString Method

Get the parameter value as a string with units.


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

Syntax

C#

public string AsValueString()

Return Value

String
The string that represents the parameter value.

Example

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;
}

VB

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

Reference

Was this information helpful?