Table of Contents

Class BinaryPrefix

Namespace
Codebelt.Unitify
Assembly
Codebelt.Unitify.dll

Defines a binary unit prefix for multiples of measurement for data that refers strictly to powers of 2. This class cannot be inherited.

public sealed class BinaryPrefix : Prefix, IPrefix
Inheritance
Object
BinaryPrefix
Implements
Inherited Members
Extension Methods

Constructors

BinaryPrefix(String, String, Double)

Initializes a new instance of the BinaryPrefix class.

public BinaryPrefix(string name, string symbol, double exponent)

Parameters

name String

The name of the binary prefix.

symbol String

The symbol of the binary prefix.

exponent Double

The number that specifies a power.

Fields

BitsPerByte

Defines how many bits is needed for one byte.

public const int BitsPerByte = 8

Field Value

Int32

BitsPerNibble

Defines how many bits is needed for one nibble (one hexadecimal digit).

public const int BitsPerNibble = 4

Field Value

Int32

Properties

BinaryPrefixes

Gets the complete sequence of multiples binary prefixes as specified by Institute of Electrical and Electronics Engineers (IEEE).

public static IEnumerable<BinaryPrefix> BinaryPrefixes { get; }

Property Value

IEnumerable<BinaryPrefix>

The complete sequence of multiples binary prefixes as specified by Institute of Electrical and Electronics Engineers (IEEE).

Exbi

Gets the binary-multiple prefix exbi (symbol 'Ei'), 2^60 = 1152921504606846976.

public static BinaryPrefix Exbi { get; }

Property Value

BinaryPrefix

The binary-multiple prefix exbi (symbol 'Ei').

Gibi

Gets the binary-multiple prefix gibi (symbol 'Gi'), 2^30 = 1073741824.

public static BinaryPrefix Gibi { get; }

Property Value

BinaryPrefix

The binary-multiple prefix gibi (symbol 'Gi').

Kibi

Gets the binary-multiple prefix kibi (symbol 'Ki'), 2^10 = 1024.

public static BinaryPrefix Kibi { get; }

Property Value

BinaryPrefix

The binary-multiple prefix kibi (symbol 'Ki').

Mebi

Gets the binary-multiple prefix mebi (symbol 'Mi'), 2^20 = 1048576.

public static BinaryPrefix Mebi { get; }

Property Value

BinaryPrefix

The binary-multiple prefix mebi (symbol 'Mi').

Pebi

Gets the binary-multiple prefix pebi (symbol 'Pi'), 2^50 = 1125899906842624.

public static BinaryPrefix Pebi { get; }

Property Value

BinaryPrefix

The binary-multiple prefix pebi (symbol 'Pi').

Tebi

Gets the binary-multiple prefix tebi (symbol 'Ti'), 2^40 = 1099511627776.

public static BinaryPrefix Tebi { get; }

Property Value

BinaryPrefix

The binary-multiple prefix tebi (symbol 'Ti').

Yobi

Gets the binary-multiple prefix yobi (symbol 'Yi'), 2^80 = 1208925819614629174706176.

public static BinaryPrefix Yobi { get; }

Property Value

BinaryPrefix

The binary-multiple prefix yobi (symbol 'Yi').

Zebi

Gets the binary-multiple prefix zebi (symbol 'Zi'), 2^70 = 1180591620717411303424.

public static BinaryPrefix Zebi { get; }

Property Value

BinaryPrefix

The binary-multiple prefix zebi (symbol 'Zi').

Methods

ConvertBitsToBytes(Double)

Converts a value in bits to bytes.

public static double ConvertBitsToBytes(double bits)

Parameters

bits Double

The value in bits to convert.

Returns

Double

The equivalent value in bytes.

ConvertBytesToBits(Double)

Converts a value in bytes to bits.

public static double ConvertBytesToBits(double bytes)

Parameters

bytes Double

The value in bytes to convert.

Returns

Double

The equivalent value in bits.

Exceptions

System.ArgumentOutOfRangeException

bytes is less than 0.

See Also