Click or drag to resize

SI2ToScaledString(Int64, String, String, String, Int32, Int64, Int64) 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.

Namespace: GSF.Units
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.181-beta
Syntax
public static string ToScaledString(
	long totalUnits,
	string format,
	string unitName,
	string[] symbolNames,
	int decimalPlaces = -1,
	long minimumFactor = 1024,
	long maximumFactor = 1152921504606846976
)
View Source

Parameters

totalUnits  Int64
Total units to represent textually.
format  String
A numeric string format for scaled totalUnits.
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  Int32  (Optional)
Optional number of decimal places to display.
minimumFactor  Int64  (Optional)
Optional minimum SI factor. Defaults to Kilo.
maximumFactor  Int64  (Optional)
Optional maximum SI factor. Defaults to Exa.

Return Value

String
A String representation of the number of units.
Exceptions
ExceptionCondition
ArgumentOutOfRangeExceptionminimumFactor or maximumFactor is not defined in Factors array.
Remarks
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.
See Also