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
valuedoubleThe numeric value to construct this quantity with.
unitMassUnitThe 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
unitMassUnit
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
centigramsdouble
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromDecagrams(double)
public static Mass FromDecagrams(double decagrams)
Parameters
decagramsdouble
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromDecigrams(double)
public static Mass FromDecigrams(double decigrams)
Parameters
decigramsdouble
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromEarthMasses(double)
public static Mass FromEarthMasses(double earthmasses)
Parameters
earthmassesdouble
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromFemtograms(double)
public static Mass FromFemtograms(double femtograms)
Parameters
femtogramsdouble
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromGrains(double)
public static Mass FromGrains(double grains)
Parameters
grainsdouble
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromGrams(double)
public static Mass FromGrams(double grams)
Parameters
gramsdouble
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromHectograms(double)
public static Mass FromHectograms(double hectograms)
Parameters
hectogramsdouble
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromKilograms(double)
public static Mass FromKilograms(double kilograms)
Parameters
kilogramsdouble
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromKilopounds(double)
public static Mass FromKilopounds(double kilopounds)
Parameters
kilopoundsdouble
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromKilotonnes(double)
public static Mass FromKilotonnes(double kilotonnes)
Parameters
kilotonnesdouble
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromLongHundredweight(double)
Creates a Mass from LongHundredweight.
public static Mass FromLongHundredweight(double longhundredweight)
Parameters
longhundredweightdouble
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromLongTons(double)
public static Mass FromLongTons(double longtons)
Parameters
longtonsdouble
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromMegapounds(double)
public static Mass FromMegapounds(double megapounds)
Parameters
megapoundsdouble
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromMegatonnes(double)
public static Mass FromMegatonnes(double megatonnes)
Parameters
megatonnesdouble
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromMicrograms(double)
public static Mass FromMicrograms(double micrograms)
Parameters
microgramsdouble
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromMilligrams(double)
public static Mass FromMilligrams(double milligrams)
Parameters
milligramsdouble
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromNanograms(double)
public static Mass FromNanograms(double nanograms)
Parameters
nanogramsdouble
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromOunces(double)
public static Mass FromOunces(double ounces)
Parameters
ouncesdouble
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromPicograms(double)
public static Mass FromPicograms(double picograms)
Parameters
picogramsdouble
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromPounds(double)
public static Mass FromPounds(double pounds)
Parameters
poundsdouble
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromShortHundredweight(double)
Creates a Mass from ShortHundredweight.
public static Mass FromShortHundredweight(double shorthundredweight)
Parameters
shorthundredweightdouble
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromShortTons(double)
public static Mass FromShortTons(double shorttons)
Parameters
shorttonsdouble
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromSlugs(double)
public static Mass FromSlugs(double slugs)
Parameters
slugsdouble
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromSolarMasses(double)
public static Mass FromSolarMasses(double solarmasses)
Parameters
solarmassesdouble
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromStone(double)
public static Mass FromStone(double stone)
Parameters
stonedouble
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromTonnes(double)
public static Mass FromTonnes(double tonnes)
Parameters
tonnesdouble
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
unitMassUnit
Returns
- Mass
A Mass with the specified unit.