Struct TimeUnit
- Namespace
 - xFunc.Maths.Expressions.Units.TimeUnits
 
- Assembly
 - xFunc.Maths.dll
 
Represents a time unit.
public readonly struct TimeUnit : IEquatable<TimeUnit>
  - Implements
 
- Inherited Members
 
Fields
Day
The day (day) unit.
public static readonly TimeUnit Day
  Field Value
Hour
The hour (h) unit.
public static readonly TimeUnit Hour
  Field Value
Microsecond
The microsecond (μs) unit.
public static readonly TimeUnit Microsecond
  Field Value
Millisecond
The millisecond (ms) unit.
public static readonly TimeUnit Millisecond
  Field Value
Minute
The minute (min) unit.
public static readonly TimeUnit Minute
  Field Value
Nanosecond
The nanosecond (ns) unit.
public static readonly TimeUnit Nanosecond
  Field Value
Second
The second (s) unit.
public static readonly TimeUnit Second
  Field Value
Week
The week (week) unit.
public static readonly TimeUnit Week
  Field Value
Year
The year (year) unit.
public static readonly TimeUnit Year
  Field Value
Properties
Factor
Gets a factor of conversion from this unit to base unit.
public double Factor { get; }
  Property Value
Names
Gets all available unit names.
public static IEnumerable<string> Names { get; }
  Property Value
UnitName
Gets a short name of the unit.
public string UnitName { get; }
  Property Value
Units
Gets all available units.
[ExcludeFromCodeCoverage]
public static IEnumerable<TimeUnit> Units { get; }
  Property Value
Methods
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
  Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
 true if
objand this instance are the same type and represent the same value; otherwise, false.
Equals(TimeUnit)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(TimeUnit other)
  Parameters
otherTimeUnitAn object to compare with this object.
Returns
FromName(string, out TimeUnit)
Gets a unit by name.
public static bool FromName(string name, out TimeUnit unit)
  Parameters
namestringThe name of unit.
unitTimeUnitWhen this method returns, the value associated with the specified name, if the unit is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized.
Returns
- bool
 trueif time units contain an unit with the specifiedname; otherwise,false.
Exceptions
- ArgumentNullException
 nameisnull.
GetHashCode()
Returns the hash code for this instance.
[ExcludeFromCodeCoverage]
public override int GetHashCode()
  Returns
- int
 A 32-bit signed integer that is the hash code for this instance.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
  Returns
- string
 The fully qualified type name.
Operators
operator ==(TimeUnit, TimeUnit)
Determines whether two specified instances of TimeUnit are equal.
public static bool operator ==(TimeUnit left, TimeUnit right)
  Parameters
Returns
- bool
 trueifleftis equal toright; otherwise,false.
operator !=(TimeUnit, TimeUnit)
Determines whether two specified instances of TimeUnit are equal.
public static bool operator !=(TimeUnit left, TimeUnit right)
  Parameters
Returns
- bool
 trueifleftis equal toright; otherwise,false.