Struct Mass
- Namespace
- UnitsNet
- Assembly
- UnitsNet.Mass.dll
In physics, mass (from Greek μᾶζα "barley cake, lump [of dough]") is a property of a physical system or body, giving rise to the phenomena of the body's resistance to being accelerated by a force and the strength of its mutual gravitational attraction with other bodies. Instruments such as mass balances or scales use those phenomena to measure mass. The SI unit of mass is the kilogram (kg).
public struct Mass
Constructors
Mass(double, MassUnit)
Creates the quantity with the given numeric value and unit.
public Mass(double value, MassUnit unit)
Parameters
value
doubleThe numeric value to construct this quantity with.
unit
MassUnitThe unit representation to construct this quantity with.
Exceptions
- ArgumentException
If value is NaN or Infinity.
Properties
BaseUnit
The base unit of Mass, which is Second. All conversions go via this value.
public static MassUnit BaseUnit { get; }
Property Value
Centigrams
public double Centigrams { get; }
Property Value
Decagrams
public double Decagrams { get; }
Property Value
Decigrams
public double Decigrams { get; }
Property Value
EarthMasses
public double EarthMasses { get; }
Property Value
Femtograms
public double Femtograms { get; }
Property Value
Grains
public double Grains { get; }
Property Value
Grams
public double Grams { get; }
Property Value
Hectograms
public double Hectograms { get; }
Property Value
Kilograms
public double Kilograms { get; }
Property Value
Kilopounds
public double Kilopounds { get; }
Property Value
Kilotonnes
public double Kilotonnes { get; }
Property Value
LongHundredweight
Gets a double value of this quantity converted into LongHundredweight
public double LongHundredweight { get; }
Property Value
LongTons
public double LongTons { get; }
Property Value
MaxValue
Represents the largest possible value of Mass.
public static Mass MaxValue { get; }
Property Value
Megapounds
public double Megapounds { get; }
Property Value
Megatonnes
public double Megatonnes { get; }
Property Value
Micrograms
public double Micrograms { get; }
Property Value
Milligrams
public double Milligrams { get; }
Property Value
MinValue
Represents the smallest possible value of Mass.
public static Mass MinValue { get; }
Property Value
Nanograms
public double Nanograms { get; }
Property Value
Ounces
public double Ounces { get; }
Property Value
Picograms
public double Picograms { get; }
Property Value
Pounds
public double Pounds { get; }
Property Value
ShortHundredweight
Gets a double value of this quantity converted into ShortHundredweight
public double ShortHundredweight { get; }
Property Value
ShortTons
public double ShortTons { get; }
Property Value
Slugs
public double Slugs { get; }
Property Value
SolarMasses
public double SolarMasses { get; }
Property Value
Stone
public double Stone { get; }
Property Value
Tonnes
public double Tonnes { get; }
Property Value
Unit
public MassUnit Unit { get; }
Property Value
Value
The numeric value this quantity was constructed with.
public double Value { get; }
Property Value
Zero
Gets an instance of this quantity with a value of 0 in the base unit Second.
public static Mass Zero { get; }
Property Value
Methods
As(MassUnit)
Convert to the unit representation unit
.
public double As(MassUnit unit)
Parameters
unit
MassUnit
Returns
- double
Value converted to the specified unit.
From(double, MassUnit)
public static Mass From(double value, MassUnit fromUnit)
Parameters
Returns
- Mass
Mass unit value.
FromCentigrams(double)
public static Mass FromCentigrams(double centigrams)
Parameters
centigrams
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromDecagrams(double)
public static Mass FromDecagrams(double decagrams)
Parameters
decagrams
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromDecigrams(double)
public static Mass FromDecigrams(double decigrams)
Parameters
decigrams
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromEarthMasses(double)
public static Mass FromEarthMasses(double earthmasses)
Parameters
earthmasses
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromFemtograms(double)
public static Mass FromFemtograms(double femtograms)
Parameters
femtograms
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromGrains(double)
public static Mass FromGrains(double grains)
Parameters
grains
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromGrams(double)
public static Mass FromGrams(double grams)
Parameters
grams
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromHectograms(double)
public static Mass FromHectograms(double hectograms)
Parameters
hectograms
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromKilograms(double)
public static Mass FromKilograms(double kilograms)
Parameters
kilograms
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromKilopounds(double)
public static Mass FromKilopounds(double kilopounds)
Parameters
kilopounds
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromKilotonnes(double)
public static Mass FromKilotonnes(double kilotonnes)
Parameters
kilotonnes
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromLongHundredweight(double)
Creates a Mass from LongHundredweight.
public static Mass FromLongHundredweight(double longhundredweight)
Parameters
longhundredweight
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromLongTons(double)
public static Mass FromLongTons(double longtons)
Parameters
longtons
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromMegapounds(double)
public static Mass FromMegapounds(double megapounds)
Parameters
megapounds
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromMegatonnes(double)
public static Mass FromMegatonnes(double megatonnes)
Parameters
megatonnes
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromMicrograms(double)
public static Mass FromMicrograms(double micrograms)
Parameters
micrograms
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromMilligrams(double)
public static Mass FromMilligrams(double milligrams)
Parameters
milligrams
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromNanograms(double)
public static Mass FromNanograms(double nanograms)
Parameters
nanograms
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromOunces(double)
public static Mass FromOunces(double ounces)
Parameters
ounces
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromPicograms(double)
public static Mass FromPicograms(double picograms)
Parameters
picograms
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromPounds(double)
public static Mass FromPounds(double pounds)
Parameters
pounds
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromShortHundredweight(double)
Creates a Mass from ShortHundredweight.
public static Mass FromShortHundredweight(double shorthundredweight)
Parameters
shorthundredweight
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromShortTons(double)
public static Mass FromShortTons(double shorttons)
Parameters
shorttons
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromSlugs(double)
public static Mass FromSlugs(double slugs)
Parameters
slugs
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromSolarMasses(double)
public static Mass FromSolarMasses(double solarmasses)
Parameters
solarmasses
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromStone(double)
public static Mass FromStone(double stone)
Parameters
stone
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromTonnes(double)
public static Mass FromTonnes(double tonnes)
Parameters
tonnes
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
ToUnit(MassUnit)
Converts this Mass to another Mass with the unit representation unit
.
public Mass ToUnit(MassUnit unit)
Parameters
unit
MassUnit
Returns
- Mass
A Mass with the specified unit.