예제 #1
0
        /// <include file='doc\Unit.uex' path='docs/doc[@for="Unit.ToString1"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public string ToString(CultureInfo culture)
        {
            if (IsEmpty)
            {
                return(String.Empty);
            }

            // Double.ToString does not do the right thing, we get extra bits at the end
            string valuePart;

            if (type == UnitType.Pixel)
            {
                valuePart = ((int)value).ToString(culture);
            }
            else
            {
                valuePart = ((float)value).ToString(culture);
            }

            return(valuePart + Unit.GetStringFromType(type));
        }