Castle.MonoRail.Framework.Helpers.FormHelper.FormatIfNecessary C# (CSharp) Method

FormatIfNecessary() protected static method

Formats if necessary.
protected static FormatIfNecessary ( object value, IDictionary attributes ) : string
value object The value.
attributes IDictionary The attributes.
return string
		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();
		}