Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public static string GetParameterValue(this Parameter p)
{
if (p == null) return string.Empty;
switch (p.StorageType)
{
case StorageType.Double:
return p.AsDouble().ToString();
case StorageType.ElementId:
try
{
return p.AsElementId().IntegerValue.ToString();
}
catch (Exception)
{
return string.Empty;
}
case StorageType.Integer:
return p.AsInteger().ToString();
case StorageType.String:
return p.AsString();
case StorageType.None:
return p.AsValueString();
}
return String.Empty;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment