C# Class GSF.Units.SI2

Defines constant factors based on 1024 for related binary SI units of measure used in computational measurements.
See NIST Reference for information on IEC standard names.
Mostrar archivo Open project: GridProtectionAlliance/gsf

Public Methods

Method Description
ToScaledString ( long totalUnits, int decimalPlaces, string unitName, string symbolNames = null, long minimumFactor = SI2.Kilo, long maximumFactor = SI2.Exa ) : string

Turns the given number of units (e.g., bytes) into a textual representation with an appropriate unit scaling and common named representation (e.g., KB, MB, GB, TB, etc.).

The symbolNames array needs one string entry for each defined SI item ordered from least (Kilo) to greatest (Exa), see Names or Symbols arrays for examples.

ToScaledString ( long totalUnits, string unitName, string symbolNames = null, long minimumFactor = SI2.Kilo, long maximumFactor = SI2.Exa ) : string

Turns the given number of units (e.g., bytes) into a textual representation with an appropriate unit scaling and common named representation (e.g., KB, MB, GB, TB, etc.).

The symbolNames array needs one string entry for each defined SI item ordered from least (Kilo) to greatest (Exa), see Names or Symbols arrays for examples.

ToScaledString ( long totalUnits, string format, string unitName, string symbolNames, int decimalPlaces = -1, long minimumFactor = SI2.Kilo, long maximumFactor = SI2.Exa ) : string

Turns the given number of units (e.g., bytes) into a textual representation with an appropriate unit scaling given string array of factor names or symbols.

The symbolNames array needs one string entry for each defined SI item ordered from least (Kilo) to greatest (Exa), see Names or Symbols arrays for examples.

Private Methods

Method Description
GetFactorIndex ( long factor ) : int

Method Details

ToScaledString() public static method

Turns the given number of units (e.g., bytes) into a textual representation with an appropriate unit scaling and common named representation (e.g., KB, MB, GB, TB, etc.).
The symbolNames array needs one string entry for each defined SI item ordered from least (Kilo) to greatest (Exa), see Names or Symbols arrays for examples.
cannot be negative. or is not defined in array.
public static ToScaledString ( long totalUnits, int decimalPlaces, string unitName, string symbolNames = null, long minimumFactor = SI2.Kilo, long maximumFactor = SI2.Exa ) : string
totalUnits long Total units to represent textually.
decimalPlaces int Number of decimal places to display.
unitName string Name of unit display (e.g., you could use "B" for bytes).
symbolNames string Optional SI factor symbol or name array to use during textual conversion, defaults to .
minimumFactor long Optional minimum SI factor. Defaults to .
maximumFactor long Optional maximum SI factor. Defaults to .
return string

ToScaledString() public static method

Turns the given number of units (e.g., bytes) into a textual representation with an appropriate unit scaling and common named representation (e.g., KB, MB, GB, TB, etc.).
The symbolNames array needs one string entry for each defined SI item ordered from least (Kilo) to greatest (Exa), see Names or Symbols arrays for examples.
or is not defined in array.
public static ToScaledString ( long totalUnits, string unitName, string symbolNames = null, long minimumFactor = SI2.Kilo, long maximumFactor = SI2.Exa ) : string
totalUnits long Total units to represent textually.
unitName string Name of unit display (e.g., you could use "B" for bytes).
symbolNames string Optional SI factor symbol or name array to use during textual conversion, defaults to .
minimumFactor long Optional minimum SI factor. Defaults to .
maximumFactor long Optional maximum SI factor. Defaults to .
return string

ToScaledString() public static method

Turns the given number of units (e.g., bytes) into a textual representation with an appropriate unit scaling given string array of factor names or symbols.
The symbolNames array needs one string entry for each defined SI item ordered from least (Kilo) to greatest (Exa), see Names or Symbols arrays for examples.
or is not defined in array.
public static ToScaledString ( long totalUnits, string format, string unitName, string symbolNames, int decimalPlaces = -1, long minimumFactor = SI2.Kilo, long maximumFactor = SI2.Exa ) : string
totalUnits long Total units to represent textually.
format string A numeric string format for scaled .
unitName string Name of unit display (e.g., you could use "B" for bytes).
symbolNames string SI factor symbol or name array to use during textual conversion.
decimalPlaces int Optional number of decimal places to display.
minimumFactor long Optional minimum SI factor. Defaults to .
maximumFactor long Optional maximum SI factor. Defaults to .
return string