Skip to content

Instantly share code, notes, and snippets.

@chuongmep
Last active May 13, 2021 03:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuongmep/43b9a72caa2e3ec7193adca3cd2c9ae3 to your computer and use it in GitHub Desktop.
Save chuongmep/43b9a72caa2e3ec7193adca3cd2c9ae3 to your computer and use it in GitHub Desktop.
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