Esempio n. 1
0
        /// <summary>Get the human-readable name for a specified unit.</summary>
        /// <param name="unit">The unit to get the name for.</param>
        /// <param name="abbreviate">Whether or not to abbreviate the name.</param>
        /// <returns>The human-readable name for the specified unit.</returns>
        static public string UnitName(UnitBinary unit, bool abbreviate)
        {
            string name;

            if (abbreviate)
            {
                if (unit == UnitBinary.Byte)
                {
                    name = "B";
                }
                else
                {
                    name = unit.ToString().Substring(0, 1) + "iB";
                }
            }
            else
            {
                name = unit.ToString();
            }

            return(name);
        }
Esempio n. 2
0
 /// <summary>Get the human-readable name for a specified unit.</summary>
 /// <param name="unit">The unit to get the name for.</param>
 /// <returns>The human-readable name for the specified unit.</returns>
 /// <remarks>Defaults to the non-abbreviated name.</remarks>
 static public string UnitName(UnitBinary unit)
 {
     return(UnitName(unit, false));
 }