Example #1
0
 /// <summary>
 /// Get bytes count in specific unit.
 /// </summary>
 /// <param name="unit">Bytes unit.</param>
 /// <returns>Bytes count.</returns>
 public         decimal this[ByteUnit unit] {
     get {
         return(this.Value / unit.GetFactor());
     }
 }
Example #2
0
 /// <summary>
 /// Convert a count of bytes in specitic unit to bytes.
 /// </summary>
 /// <param name="value">Bytes count.</param>
 /// <param name="unit">Bytes unit.</param>
 /// <returns>Bytes count.</returns>
 public static decimal ToBytes(decimal value, ByteUnit unit)
 {
     return(value * unit.GetFactor());
 }