コード例 #1
0
        /// <summary>
        /// Converts the <see cref="object" /> that is convertible to an <see cref="ulong" />? value based on the specified parameters.
        /// </summary>
        /// <param name="value">The <see cref="object" /> that is convertible to an <see cref="ulong" />? value to convert.</param>
        /// <returns>
        /// A <see cref="string" /> with the result of the conversion.
        /// </returns>
        public override string Convert(object value)
        {
            if (value == null)
            {
                return(null);
            }
            else
            {
                ByteSize byteSize = new ByteSize(System.Convert.ToUInt64(value));

                if (Unit == null)
                {
                    return(byteSize.Format(Decimals, PadDecimals, ThousandsSeparator, RoundUp));
                }
                else
                {
                    return(byteSize.FormatWithUnit(Unit.Value, Decimals, PadDecimals, ThousandsSeparator, RoundUp));
                }
            }
        }