Last active
May 13, 2021 03:53
-
-
Save chuongmep/43b9a72caa2e3ec7193adca3cd2c9ae3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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