protected static string FormatIfNecessary(object value, IDictionary attributes)
{
string formatString = CommonUtils.ObtainEntryAndRemove(attributes, "textformat");
if (value != null && formatString != null)
{
IFormattable formattable = value as IFormattable;
if (formattable != null)
{
value = formattable.ToString(formatString, null);
}
}
else if (value == null)
{
value = String.Empty;
}
return value.ToString();
}