Struct BaseUnit
- Namespace
- Codebelt.Unitify
- Assembly
- Codebelt.Unitify.dll
Represents a base unit of measurement, including its category, name, and symbol.
public readonly struct BaseUnit : IBaseUnit, IEquatable<IBaseUnit>
- Implements
-
IEquatable<IBaseUnit>
- Inherited Members
-
ValueType.ToString()
Constructors
BaseUnit(String, String, String)
Initializes a new instance of the BaseUnit class.
public BaseUnit(string category, string name, string symbol)
Parameters
category
StringThe category of the base unit.
name
StringThe name of the base unit.
symbol
StringThe symbol of the base unit.
Properties
Category
Gets the category of the base unit.
public readonly string Category { get; }
Property Value
- String
The category of the base unit.
Name
Gets the name of the base unit.
public readonly string Name { get; }
Property Value
- String
The name of the base unit.
Symbol
Gets the symbol of the base unit.
public readonly string Symbol { get; }
Property Value
- String
The symbol of the base unit.
Methods
Equals(IBaseUnit)
Indicates whether the current object is equal to another object of the same type.
public readonly bool Equals(IBaseUnit other)
Parameters
other
IBaseUnitAn 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 object is equal to the current object.
public override readonly bool Equals(object obj)
Parameters
obj
ObjectThe object to compare with the current object.
Returns
- Boolean
true
if the specified object is equal to the current object; otherwise,false
.
GetHashCode()
Returns a hash code for this instance.
public override readonly int GetHashCode()
Returns
- Int32
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
Operators
Equality(BaseUnit, BaseUnit)
Determines whether two specified instances of BaseUnit are equal.
public static bool operator ==(BaseUnit left, BaseUnit right)
Parameters
Returns
- Boolean
true
if the two BaseUnit instances are equal; otherwise,false
.
Inequality(BaseUnit, BaseUnit)
Determines whether two specified instances of BaseUnit are not equal.
public static bool operator !=(BaseUnit left, BaseUnit right)
Parameters
Returns
- Boolean
true
if the two BaseUnit instances are not equal; otherwise,false
.