Table of Contents

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 double

The numeric value to construct this quantity with.

unit MassUnit

The 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

MassUnit

Centigrams

Gets a double value of this quantity converted into Centigram

public double Centigrams { get; }

Property Value

double

Decagrams

Gets a double value of this quantity converted into Decagram

public double Decagrams { get; }

Property Value

double

Decigrams

Gets a double value of this quantity converted into Decigram

public double Decigrams { get; }

Property Value

double

EarthMasses

Gets a double value of this quantity converted into EarthMass

public double EarthMasses { get; }

Property Value

double

Femtograms

Gets a double value of this quantity converted into Femtogram

public double Femtograms { get; }

Property Value

double

Grains

Gets a double value of this quantity converted into Grain

public double Grains { get; }

Property Value

double

Grams

Gets a double value of this quantity converted into Gram

public double Grams { get; }

Property Value

double

Hectograms

Gets a double value of this quantity converted into Hectogram

public double Hectograms { get; }

Property Value

double

Kilograms

Gets a double value of this quantity converted into Kilogram

public double Kilograms { get; }

Property Value

double

Kilopounds

Gets a double value of this quantity converted into Kilopound

public double Kilopounds { get; }

Property Value

double

Kilotonnes

Gets a double value of this quantity converted into Kilotonne

public double Kilotonnes { get; }

Property Value

double

LongHundredweight

Gets a double value of this quantity converted into LongHundredweight

public double LongHundredweight { get; }

Property Value

double

LongTons

Gets a double value of this quantity converted into LongTon

public double LongTons { get; }

Property Value

double

MaxValue

Represents the largest possible value of Mass.

public static Mass MaxValue { get; }

Property Value

Mass

Megapounds

Gets a double value of this quantity converted into Megapound

public double Megapounds { get; }

Property Value

double

Megatonnes

Gets a double value of this quantity converted into Megatonne

public double Megatonnes { get; }

Property Value

double

Micrograms

Gets a double value of this quantity converted into Microgram

public double Micrograms { get; }

Property Value

double

Milligrams

Gets a double value of this quantity converted into Milligram

public double Milligrams { get; }

Property Value

double

MinValue

Represents the smallest possible value of Mass.

public static Mass MinValue { get; }

Property Value

Mass

Nanograms

Gets a double value of this quantity converted into Nanogram

public double Nanograms { get; }

Property Value

double

Ounces

Gets a double value of this quantity converted into Ounce

public double Ounces { get; }

Property Value

double

Picograms

Gets a double value of this quantity converted into Picogram

public double Picograms { get; }

Property Value

double

Pounds

Gets a double value of this quantity converted into Pound

public double Pounds { get; }

Property Value

double

ShortHundredweight

Gets a double value of this quantity converted into ShortHundredweight

public double ShortHundredweight { get; }

Property Value

double

ShortTons

Gets a double value of this quantity converted into ShortTon

public double ShortTons { get; }

Property Value

double

Slugs

Gets a double value of this quantity converted into Slug

public double Slugs { get; }

Property Value

double

SolarMasses

Gets a double value of this quantity converted into SolarMass

public double SolarMasses { get; }

Property Value

double

Stone

Gets a double value of this quantity converted into Stone

public double Stone { get; }

Property Value

double

Tonnes

Gets a double value of this quantity converted into Tonne

public double Tonnes { get; }

Property Value

double

Unit

public MassUnit Unit { get; }

Property Value

MassUnit

Value

The numeric value this quantity was constructed with.

public double Value { get; }

Property Value

double

Zero

Gets an instance of this quantity with a value of 0 in the base unit Second.

public static Mass Zero { get; }

Property Value

Mass

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)

Dynamically convert from value and unit enum MassUnit to Mass.

public static Mass From(double value, MassUnit fromUnit)

Parameters

value double

Value to convert from.

fromUnit MassUnit

Unit to convert from.

Returns

Mass

Mass unit value.

FromCentigrams(double)

Creates a Mass from Centigram.

public static Mass FromCentigrams(double centigrams)

Parameters

centigrams double

Returns

Mass

Exceptions

ArgumentException

If value is NaN or Infinity.

FromDecagrams(double)

Creates a Mass from Decagram.

public static Mass FromDecagrams(double decagrams)

Parameters

decagrams double

Returns

Mass

Exceptions

ArgumentException

If value is NaN or Infinity.

FromDecigrams(double)

Creates a Mass from Decigram.

public static Mass FromDecigrams(double decigrams)

Parameters

decigrams double

Returns

Mass

Exceptions

ArgumentException

If value is NaN or Infinity.

FromEarthMasses(double)

Creates a Mass from EarthMass.

public static Mass FromEarthMasses(double earthmasses)

Parameters

earthmasses double

Returns

Mass

Exceptions

ArgumentException

If value is NaN or Infinity.

FromFemtograms(double)

Creates a Mass from Femtogram.

public static Mass FromFemtograms(double femtograms)

Parameters

femtograms double

Returns

Mass

Exceptions

ArgumentException

If value is NaN or Infinity.

FromGrains(double)

Creates a Mass from Grain.

public static Mass FromGrains(double grains)

Parameters

grains double

Returns

Mass

Exceptions

ArgumentException

If value is NaN or Infinity.

FromGrams(double)

Creates a Mass from Gram.

public static Mass FromGrams(double grams)

Parameters

grams double

Returns

Mass

Exceptions

ArgumentException

If value is NaN or Infinity.

FromHectograms(double)

Creates a Mass from Hectogram.

public static Mass FromHectograms(double hectograms)

Parameters

hectograms double

Returns

Mass

Exceptions

ArgumentException

If value is NaN or Infinity.

FromKilograms(double)

Creates a Mass from Kilogram.

public static Mass FromKilograms(double kilograms)

Parameters

kilograms double

Returns

Mass

Exceptions

ArgumentException

If value is NaN or Infinity.

FromKilopounds(double)

Creates a Mass from Kilopound.

public static Mass FromKilopounds(double kilopounds)

Parameters

kilopounds double

Returns

Mass

Exceptions

ArgumentException

If value is NaN or Infinity.

FromKilotonnes(double)

Creates a Mass from Kilotonne.

public static Mass FromKilotonnes(double kilotonnes)

Parameters

kilotonnes double

Returns

Mass

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

Mass

Exceptions

ArgumentException

If value is NaN or Infinity.

FromLongTons(double)

Creates a Mass from LongTon.

public static Mass FromLongTons(double longtons)

Parameters

longtons double

Returns

Mass

Exceptions

ArgumentException

If value is NaN or Infinity.

FromMegapounds(double)

Creates a Mass from Megapound.

public static Mass FromMegapounds(double megapounds)

Parameters

megapounds double

Returns

Mass

Exceptions

ArgumentException

If value is NaN or Infinity.

FromMegatonnes(double)

Creates a Mass from Megatonne.

public static Mass FromMegatonnes(double megatonnes)

Parameters

megatonnes double

Returns

Mass

Exceptions

ArgumentException

If value is NaN or Infinity.

FromMicrograms(double)

Creates a Mass from Microgram.

public static Mass FromMicrograms(double micrograms)

Parameters

micrograms double

Returns

Mass

Exceptions

ArgumentException

If value is NaN or Infinity.

FromMilligrams(double)

Creates a Mass from Milligram.

public static Mass FromMilligrams(double milligrams)

Parameters

milligrams double

Returns

Mass

Exceptions

ArgumentException

If value is NaN or Infinity.

FromNanograms(double)

Creates a Mass from Nanogram.

public static Mass FromNanograms(double nanograms)

Parameters

nanograms double

Returns

Mass

Exceptions

ArgumentException

If value is NaN or Infinity.

FromOunces(double)

Creates a Mass from Ounce.

public static Mass FromOunces(double ounces)

Parameters

ounces double

Returns

Mass

Exceptions

ArgumentException

If value is NaN or Infinity.

FromPicograms(double)

Creates a Mass from Picogram.

public static Mass FromPicograms(double picograms)

Parameters

picograms double

Returns

Mass

Exceptions

ArgumentException

If value is NaN or Infinity.

FromPounds(double)

Creates a Mass from Pound.

public static Mass FromPounds(double pounds)

Parameters

pounds double

Returns

Mass

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

Mass

Exceptions

ArgumentException

If value is NaN or Infinity.

FromShortTons(double)

Creates a Mass from ShortTon.

public static Mass FromShortTons(double shorttons)

Parameters

shorttons double

Returns

Mass

Exceptions

ArgumentException

If value is NaN or Infinity.

FromSlugs(double)

Creates a Mass from Slug.

public static Mass FromSlugs(double slugs)

Parameters

slugs double

Returns

Mass

Exceptions

ArgumentException

If value is NaN or Infinity.

FromSolarMasses(double)

Creates a Mass from SolarMass.

public static Mass FromSolarMasses(double solarmasses)

Parameters

solarmasses double

Returns

Mass

Exceptions

ArgumentException

If value is NaN or Infinity.

FromStone(double)

Creates a Mass from Stone.

public static Mass FromStone(double stone)

Parameters

stone double

Returns

Mass

Exceptions

ArgumentException

If value is NaN or Infinity.

FromTonnes(double)

Creates a Mass from Tonne.

public static Mass FromTonnes(double tonnes)

Parameters

tonnes double

Returns

Mass

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.