예제 #1
0
        internal static string Format(object value, string format, out bool foundMatchingFormatter)
        {
            foundMatchingFormatter = false;

            if (value == null)
            {
                return(null);
            }

            if (format == null)
            {
                format = String.Empty;
            }

            ChoTypeObjectFormatInfo[] typeObjectsFormatInfo = ChoTypesManager.GetTypeObjectsFormatInfo();
            if (typeObjectsFormatInfo != null && typeObjectsFormatInfo.Length > 0)
            {
                foreach (ChoTypeObjectFormatInfo typeObjectFormatInfo in typeObjectsFormatInfo)
                {
                    if (typeObjectFormatInfo.CanFormat(value))
                    {
                        foundMatchingFormatter = true;
                        return(typeObjectFormatInfo.Format(value, format));
                    }
                }
            }

            return(null);
        }