Struct BaseUnit
Represents a base unit of measurement, including its category, name, and symbol.
public readonly struct BaseUnit : IBaseUnit, IEquatable<IBaseUnit>
- Implements
- Inherited Members
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 string Category { get; }
Property Value
- string
The category of the base unit.
Name
Gets the name of the base unit.
public string Name { get; }
Property Value
- string
The name of the base unit.
Symbol
Gets the symbol of the base unit.
public 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 bool Equals(IBaseUnit other)
Parameters
other
IBaseUnitAn object to compare with this object.
Returns
- bool
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 bool Equals(object obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
- bool
true
if the specified object is equal to the current object; otherwise,false
.
GetHashCode()
Returns a hash code for this instance.
public override int GetHashCode()
Returns
- int
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
Operators
operator ==(BaseUnit, BaseUnit)
Determines whether two specified instances of BaseUnit are equal.
public static bool operator ==(BaseUnit left, BaseUnit right)
Parameters
Returns
operator !=(BaseUnit, BaseUnit)
Determines whether two specified instances of BaseUnit are not equal.
public static bool operator !=(BaseUnit left, BaseUnit right)