Class PrefixUnit
- Namespace
- Cuemon
- Assembly
- Cuemon.Core.dll
Represents the base class from which all implementations of a unit of measurement should derive. Implements the IPrefixUnit
public abstract class PrefixUnit : IPrefixUnit, IUnit, IEquatable<IUnit>
- Inheritance
-
ObjectPrefixUnit
- Implements
-
IEquatable<IUnit>
- Derived
Constructors
PrefixUnit(String, String, Double, IPrefixMultiple, Action<UnitFormatOptions>)
Initializes a new instance of the ByteUnit struct.
protected PrefixUnit(string name, string symbol, double value, IPrefixMultiple prefix, Action<UnitFormatOptions> setup = null)
Parameters
name
StringThe name of the unit.
symbol
StringThe symbol of the unit.
value
DoubleThe value of this unit expressed as bytes.
prefix
IPrefixMultipleThe prefix to associate with this unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Exceptions
- System.ArgumentNullException
name
cannot be null -or-symbol
cannot be null.- ArgumentException
name
cannot be empty or consist only of white-space characters -or-symbol
cannot be empty or consist only of white-space characters.- ArgumentOutOfRangeException
value
is lower than 0.
Properties
Prefix
Gets the prefix multiple to this unit.
public IPrefixMultiple Prefix { get; }
Property Value
- IPrefixMultiple
The prefix multiple to this unit.
PrefixValue
Gets the prefix value of this unit.
public double PrefixValue { get; }
Property Value
- Double
The prefix value of this unit.
UnitName
Gets the name of this unit.
public string UnitName { get; }
Property Value
- String
The name of this unit.
UnitSymbol
Gets the symbol of this unit.
public string UnitSymbol { get; }
Property Value
- String
The symbol of this unit.
UnitValue
Gets the value of this unit expressed as bytes.
public double UnitValue { get; }
Property Value
- Double
The value of this unit.
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
.
ToString()
Returns a System.String that represents this instance.
public override string ToString()
Returns
- String
A System.String that represents this instance.
ToString(Action<UnitFormatOptions>)
Returns a System.String that represents this instance.
public string ToString(Action<UnitFormatOptions> setup)
Parameters
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- String
A System.String that represents this instance.