Class DataPrefixTable
- Namespace
- Codebelt.Unitify
- Assembly
- Codebelt.Unitify.dll
Represents a table of both binary and metric prefixes for units of measure, optimized for data quantity and transmission measurement standards.
public class DataPrefixTable : PrefixTable, IEquatable<IUnit>, IEnumerable<IPrefixUnit>, IEnumerable
- Inheritance
-
ObjectDataPrefixTable
- Implements
-
IEquatable<IUnit>IEnumerable<IPrefixUnit>IEnumerable
- Inherited Members
- Extension Methods
Constructors
DataPrefixTable(IUnit)
Initializes a new instance of the DataPrefixTable class.
public DataPrefixTable(IUnit unit)
Parameters
Exceptions
- System.ArgumentNullException
unit
cannot be null.
Fields
DefaultNumberFormat
The default number format used for displaying values related to DataPrefixTable.
public const string DefaultNumberFormat = "#,##0.##"
Field Value
- String
Methods
CreateBitTableFromBits(Double, Action<UnitFormatOptions>)
Creates a new instance of DataPrefixTable initialized with value
.
public static DataPrefixTable CreateBitTableFromBits(double value, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe System.Double to convert.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- DataPrefixTable
A DataPrefixTable that is equivalent to
value
with a base unit of Bit.
CreateBitTableFromBytes(Double, Action<UnitFormatOptions>)
Creates a new instance of DataPrefixTable initialized with value
.
public static DataPrefixTable CreateBitTableFromBytes(double value, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe System.Double to convert.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- DataPrefixTable
A DataPrefixTable that is equivalent to
value
with a base unit of Bit.
CreateByteTableFromBits(Double, Action<UnitFormatOptions>)
Creates a new instance of DataPrefixTable initialized with value
.
public static DataPrefixTable CreateByteTableFromBits(double value, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe System.Double to convert.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- DataPrefixTable
A DataPrefixTable that is equivalent to
value
with a base unit of Byte.
CreateByteTableFromBytes(Double, Action<UnitFormatOptions>)
Creates a new instance of DataPrefixTable initialized with value
.
public static DataPrefixTable CreateByteTableFromBytes(double value, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe System.Double to convert.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- DataPrefixTable
A DataPrefixTable that is equivalent to
value
with a base unit of Byte.
GetEnumerator()
Returns an enumerator that iterates through the collection of prefixes.
public override IEnumerator<IPrefixUnit> GetEnumerator()
Returns
- IEnumerator<IPrefixUnit>
An enumerator that can be used to iterate through the collection of prefixes.
ToAggregateString(Boolean, Boolean, Boolean)
Returns an aggregated System.String of all multiple prefixes of this instance.
public string ToAggregateString(bool includeBinary = true, bool includeDecimal = true, bool includeUnit = true)
Parameters
includeBinary
BooleanIf set to
true
, includes all binary-multiple prefixes in the aggregate.includeDecimal
BooleanIf set to
true
, includes all metric-multiple prefixes in the aggregate.includeUnit
BooleanIf set to
true
, includes the base unit in the aggregate.
Returns
- String
An aggregated System.String of all multiple prefixes of this instance.
ToString()
Returns a System.String that represents the largest multiple prefix of this instance.
public override string ToString()
Returns
- String
A System.String that represents the largest multiple prefix of this instance.
Remarks
Evaluates the largest multiple prefix that is greater or equal to 1 and returns it formatted as Binary.
ToString(PrefixStyle)
Returns a System.String that represents the largest multiple prefix of this instance.
public string ToString(PrefixStyle prefixStyle)
Parameters
prefixStyle
PrefixStyleThe preferred unit prefix style for formatting.
Returns
- String
A System.String that represents the largest multiple prefix of this instance.
Remarks
Evaluates the largest metric-multiple prefix that is greater or equal to 1 and returns it formatted as either Binary or Decimal.