Class PrefixTable
- Namespace
- Codebelt.Unitify
- Assembly
- Codebelt.Unitify.dll
Represents a table of unit prefixes, indicating multiples or submultiples of a base unit.
public abstract class PrefixTable : IEquatable<IUnit>, IEnumerable<IPrefixUnit>, IEnumerable
- Inheritance
-
ObjectPrefixTable
- Implements
-
IEquatable<IUnit>IEnumerable<IPrefixUnit>IEnumerable
- Derived
- Extension Methods
Constructors
PrefixTable(IUnit)
Initializes a new instance of the PrefixTable class.
protected PrefixTable(IUnit unit)
Parameters
Exceptions
- System.ArgumentNullException
unit
cannot be null.
Properties
BaseUnit
Gets the base unit of this table.
public IUnit BaseUnit { get; }
Property Value
- IUnit
The base unit of this table.
Methods
Equals(IUnit)
Indicates whether the current object is equal to another object of the same type.
public virtual bool Equals(IUnit other)
Parameters
other
IUnitAn object to compare with this object.
Returns
- Boolean
true
if the current object is equal to theother
parameter; otherwise,false
.
Equals(Object)
Determines whether the specified System.Object is equal to this instance.
public override bool Equals(object obj)
Parameters
obj
ObjectThe object to compare with the current object.
Returns
- Boolean
true
if the specified System.Object is equal to this instance; otherwise,false
.
GetEnumerator()
Returns an enumerator that iterates through the multiples and/or submultiples of the base unit.
public abstract IEnumerator<IPrefixUnit> GetEnumerator()
Returns
- IEnumerator<IPrefixUnit>
An enumerator that can be used to iterate through multiples and/or submultiples of the base unit.
GetHashCode()
Returns a hash code for this instance.
public override int GetHashCode()
Returns
- Int32
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
ToString()
Returns a System.String that represents largest metric-multiple prefix of this instance.
public override string ToString()
Returns
- String
A System.String that represents largest metric-multiple prefix of this instance.
Remarks
Evaluates the largest metric-multiple prefix that is greater or equal to 1 and returns that as either Binary or Decimal formatted.
Operators
Implicit(PrefixTable to Double)
Performs an implicit conversion from PrefixTable to System.Double.
public static implicit operator double (PrefixTable mt)
Parameters
mt
PrefixTableThe PrefixTable to convert.
Returns
- Double
A System.Double that is equivalent to
mt
.
Explicit Interface Implementations
IEnumerable.GetEnumerator()
IEnumerator IEnumerable.GetEnumerator()
Returns
- IEnumerator