diff --git a/ICD.Common.Utils/StringUtils.cs b/ICD.Common.Utils/StringUtils.cs
index e339eaf..4acac1c 100644
--- a/ICD.Common.Utils/StringUtils.cs
+++ b/ICD.Common.Utils/StringUtils.cs
@@ -115,6 +115,16 @@ namespace ICD.Common.Utils
return string.Join("", strings);
}
+ ///
+ /// Uses String.Format to properly handle null values.
+ ///
+ ///
+ ///
+ public static string ToString(object value)
+ {
+ return string.Format("{0}", value);
+ }
+
///
/// Converts bytes to an ascii string.
///
@@ -360,7 +370,7 @@ namespace ICD.Common.Utils
if (items == null)
throw new ArgumentNullException("items");
- return string.Format("[{0}]", string.Join(", ", items.Select(i => i.ToString()).ToArray()));
+ return string.Format("[{0}]", string.Join(", ", items.Select(i => ToString(i)).ToArray()));
}
///
@@ -377,7 +387,7 @@ namespace ICD.Common.Utils
string[] ranges = MathUtils.GetRanges(items)
.Select(r => r[0] == r[1]
- ? r[0].ToString()
+ ? ToString(r[0])
: string.Format("{0}-{1}", r[0], r[1]))
.ToArray();