Show / Hide Table of Contents

Class SIUnitDefinition

The most straight-forward implementation of a unit: one that is directly derived from SI units.

Inheritance
object
SIUnitDefinition
Implements
IUnit
IEquatable<IUnit>
Inherited Members
object.Equals(object, object)
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
Namespace: SpiceSharp.Simulations
Assembly: SpiceSharp.dll
Syntax
public class SIUnitDefinition : IUnit, IEquatable<IUnit>

Constructors

SIUnitDefinition(string, SIUnits)

Initializes a new instance of the SIUnitDefinition class.

Declaration
public SIUnitDefinition(string name, SIUnits units)
Parameters
Type Name Description
string name

The name of the unit.

SIUnits units

The SI units.

Exceptions
Type Condition
ArgumentNullException

Thrown if name is null.

Properties

BaseValue

Gets the base value expressed in SI units (no transformations applied).

Declaration
public double BaseValue { get; }
Property Value
Type Description
double

The base value.

SI

Gets the underlying SI units.

Declaration
public SIUnits SI { get; }
Property Value
Type Description
SIUnits

The SI units.

Methods

Equals(IUnit)

Indicates whether the current object is equal to another object of the same type.

Declaration
public bool Equals(IUnit other)
Parameters
Type Name Description
IUnit other

An object to compare with this object.

Returns
Type Description
bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object)

Determines whether the specified object, is equal to this instance.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
object obj

The object to compare with this instance.

Returns
Type Description
bool

true if the specified object is equal to this instance; otherwise, false.

Overrides
object.Equals(object)

From(double)

Converts a base value expressed strictly in SI units (without transformations) to this unit.

Declaration
public double From(double value)
Parameters
Type Name Description
double value

The value.

Returns
Type Description
double

The value in these units.

GetHashCode()

Returns a hash code for this instance.

Declaration
public override int GetHashCode()
Returns
Type Description
int

A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

Overrides
object.GetHashCode()

ToString()

Converts to string.

Declaration
public override string ToString()
Returns
Type Description
string

A string that represents this instance.

Overrides
object.ToString()

Implements

IUnit
IEquatable<T>

Extension Methods

Utility.ThrowIfNull<T>(T, string)

See Also

IUnit
In this article
Back to top Generated by DocFX