Skip to main content
Version: 2.11.10

Humanizer.Bytes.ByteSize

ByteSize Struct

Represents a byte size value.

public struct ByteSize : System.IComparable<Humanizer.Bytes.ByteSize>, System.IEquatable<Humanizer.Bytes.ByteSize>, System.IComparable, System.IFormattable

Implements System.IComparable<ByteSize>, System.IEquatable<ByteSize>, System.IComparable, System.IFormattable

Constructors

ByteSize(double) Constructor

public ByteSize(double byteSize);

Parameters

byteSize System.Double

Fields

ByteSize.Bit Field

public const string Bit = "bit";

Field Value

System.String

ByteSize.BitsInByte Field

public const long BitsInByte = 8;

Field Value

System.Int64

ByteSize.BitSymbol Field

public const string BitSymbol = "b";

Field Value

System.String

ByteSize.Byte Field

public const string Byte = "byte";

Field Value

System.String

ByteSize.BytesInGigabyte Field

public const long BytesInGigabyte = 1073741824;

Field Value

System.Int64

ByteSize.BytesInKilobyte Field

public const long BytesInKilobyte = 1024;

Field Value

System.Int64

ByteSize.BytesInMegabyte Field

public const long BytesInMegabyte = 1048576;

Field Value

System.Int64

ByteSize.BytesInTerabyte Field

public const long BytesInTerabyte = 1099511627776;

Field Value

System.Int64

ByteSize.ByteSymbol Field

public const string ByteSymbol = "B";

Field Value

System.String

ByteSize.Gigabyte Field

public const string Gigabyte = "gigabyte";

Field Value

System.String

ByteSize.GigabyteSymbol Field

public const string GigabyteSymbol = "GB";

Field Value

System.String

ByteSize.Kilobyte Field

public const string Kilobyte = "kilobyte";

Field Value

System.String

ByteSize.KilobyteSymbol Field

public const string KilobyteSymbol = "KB";

Field Value

System.String

ByteSize.MaxValue Field

public static readonly ByteSize MaxValue;

Field Value

ByteSize

ByteSize.Megabyte Field

public const string Megabyte = "megabyte";

Field Value

System.String

ByteSize.MegabyteSymbol Field

public const string MegabyteSymbol = "MB";

Field Value

System.String

ByteSize.MinValue Field

public static readonly ByteSize MinValue;

Field Value

ByteSize

ByteSize.Terabyte Field

public const string Terabyte = "terabyte";

Field Value

System.String

ByteSize.TerabyteSymbol Field

public const string TerabyteSymbol = "TB";

Field Value

System.String

Properties

ByteSize.Bits Property

public long Bits { get; }

Property Value

System.Int64

ByteSize.Bytes Property

public double Bytes { get; }

Property Value

System.Double

ByteSize.Gigabytes Property

public double Gigabytes { get; }

Property Value

System.Double

ByteSize.Kilobytes Property

public double Kilobytes { get; }

Property Value

System.Double

ByteSize.LargestWholeNumberFullWord Property

public string LargestWholeNumberFullWord { get; }

Property Value

System.String

ByteSize.LargestWholeNumberSymbol Property

public string LargestWholeNumberSymbol { get; }

Property Value

System.String

ByteSize.LargestWholeNumberValue Property

public double LargestWholeNumberValue { get; }

Property Value

System.Double

ByteSize.Megabytes Property

public double Megabytes { get; }

Property Value

System.Double

ByteSize.Terabytes Property

public double Terabytes { get; }

Property Value

System.Double

Methods

ByteSize.Add(ByteSize) Method

public Humanizer.Bytes.ByteSize Add(Humanizer.Bytes.ByteSize bs);

Parameters

bs ByteSize

Returns

ByteSize

ByteSize.AddBits(long) Method

public Humanizer.Bytes.ByteSize AddBits(long value);

Parameters

value System.Int64

Returns

ByteSize

ByteSize.AddBytes(double) Method

public Humanizer.Bytes.ByteSize AddBytes(double value);

Parameters

value System.Double

Returns

ByteSize

ByteSize.AddGigabytes(double) Method

public Humanizer.Bytes.ByteSize AddGigabytes(double value);

Parameters

value System.Double

Returns

ByteSize

ByteSize.AddKilobytes(double) Method

public Humanizer.Bytes.ByteSize AddKilobytes(double value);

Parameters

value System.Double

Returns

ByteSize

ByteSize.AddMegabytes(double) Method

public Humanizer.Bytes.ByteSize AddMegabytes(double value);

Parameters

value System.Double

Returns

ByteSize

ByteSize.AddTerabytes(double) Method

public Humanizer.Bytes.ByteSize AddTerabytes(double value);

Parameters

value System.Double

Returns

ByteSize

ByteSize.CompareTo(ByteSize) Method

public int CompareTo(Humanizer.Bytes.ByteSize other);

Parameters

other ByteSize

Returns

System.Int32

ByteSize.CompareTo(object) Method

public int CompareTo(object obj);

Parameters

obj System.Object

Implements CompareTo(object)

Returns

System.Int32

ByteSize.Equals(ByteSize) Method

public bool Equals(Humanizer.Bytes.ByteSize value);

Parameters

value ByteSize

Returns

System.Boolean

ByteSize.Equals(object) Method

public override bool Equals(object value);

Parameters

value System.Object

Returns

System.Boolean

ByteSize.FromBits(long) Method

public static Humanizer.Bytes.ByteSize FromBits(long value);

Parameters

value System.Int64

Returns

ByteSize

ByteSize.FromBytes(double) Method

public static Humanizer.Bytes.ByteSize FromBytes(double value);

Parameters

value System.Double

Returns

ByteSize

ByteSize.FromGigabytes(double) Method

public static Humanizer.Bytes.ByteSize FromGigabytes(double value);

Parameters

value System.Double

Returns

ByteSize

ByteSize.FromKilobytes(double) Method

public static Humanizer.Bytes.ByteSize FromKilobytes(double value);

Parameters

value System.Double

Returns

ByteSize

ByteSize.FromMegabytes(double) Method

public static Humanizer.Bytes.ByteSize FromMegabytes(double value);

Parameters

value System.Double

Returns

ByteSize

ByteSize.FromTerabytes(double) Method

public static Humanizer.Bytes.ByteSize FromTerabytes(double value);

Parameters

value System.Double

Returns

ByteSize

ByteSize.GetHashCode() Method

public override int GetHashCode();

Returns

System.Int32

ByteSize.GetLargestWholeNumberFullWord(IFormatProvider) Method

public string GetLargestWholeNumberFullWord(System.IFormatProvider provider=null);

Parameters

provider System.IFormatProvider

Returns

System.String

ByteSize.GetLargestWholeNumberSymbol(IFormatProvider) Method

public string GetLargestWholeNumberSymbol(System.IFormatProvider provider=null);

Parameters

provider System.IFormatProvider

Returns

System.String

ByteSize.Parse(string) Method

public static Humanizer.Bytes.ByteSize Parse(string s);

Parameters

s System.String

Returns

ByteSize

ByteSize.Parse(string, IFormatProvider) Method

public static Humanizer.Bytes.ByteSize Parse(string s, System.IFormatProvider formatProvider);

Parameters

s System.String

formatProvider System.IFormatProvider

Returns

ByteSize

ByteSize.Subtract(ByteSize) Method

public Humanizer.Bytes.ByteSize Subtract(Humanizer.Bytes.ByteSize bs);

Parameters

bs ByteSize

Returns

ByteSize

ByteSize.ToFullWords(string, IFormatProvider) Method

Converts the value of the current ByteSize object to a string with full words. The metric prefix symbol (bit, byte, kilo, mega, giga, tera) used is the largest metric prefix such that the corresponding value is greater than or equal to one.

public string ToFullWords(string format=null, System.IFormatProvider provider=null);

Parameters

format System.String

provider System.IFormatProvider

Returns

System.String

ByteSize.ToString() Method

Converts the value of the current ByteSize object to a string. The metric prefix symbol (bit, byte, kilo, mega, giga, tera) used is the largest metric prefix such that the corresponding value is greater than or equal to one.

public override string ToString();

Returns

System.String

ByteSize.ToString(string) Method

public string ToString(string format);

Parameters

format System.String

Returns

System.String

ByteSize.ToString(string, IFormatProvider) Method

public string ToString(string format, System.IFormatProvider provider);

Parameters

format System.String

provider System.IFormatProvider

Implements ToString(string, IFormatProvider)

Returns

System.String

ByteSize.ToString(IFormatProvider) Method

public string ToString(System.IFormatProvider provider);

Parameters

provider System.IFormatProvider

Returns

System.String

ByteSize.TryParse(string, ByteSize) Method

public static bool TryParse(string s, out Humanizer.Bytes.ByteSize result);

Parameters

s System.String

result ByteSize

Returns

System.Boolean

ByteSize.TryParse(string, IFormatProvider, ByteSize) Method

public static bool TryParse(string s, System.IFormatProvider formatProvider, out Humanizer.Bytes.ByteSize result);

Parameters

s System.String

formatProvider System.IFormatProvider

result ByteSize

Returns

System.Boolean

Operators

ByteSize.operator +(ByteSize, ByteSize) Operator

public static Humanizer.Bytes.ByteSize operator +(Humanizer.Bytes.ByteSize b1, Humanizer.Bytes.ByteSize b2);

Parameters

b1 ByteSize

b2 ByteSize

Returns

ByteSize

ByteSize.operator --(ByteSize) Operator

public static Humanizer.Bytes.ByteSize operator --(Humanizer.Bytes.ByteSize b);

Parameters

b ByteSize

Returns

ByteSize

ByteSize.operator ==(ByteSize, ByteSize) Operator

public static bool operator ==(Humanizer.Bytes.ByteSize b1, Humanizer.Bytes.ByteSize b2);

Parameters

b1 ByteSize

b2 ByteSize

Returns

System.Boolean

ByteSize.operator >(ByteSize, ByteSize) Operator

public static bool operator >(Humanizer.Bytes.ByteSize b1, Humanizer.Bytes.ByteSize b2);

Parameters

b1 ByteSize

b2 ByteSize

Returns

System.Boolean

ByteSize.operator >=(ByteSize, ByteSize) Operator

public static bool operator >=(Humanizer.Bytes.ByteSize b1, Humanizer.Bytes.ByteSize b2);

Parameters

b1 ByteSize

b2 ByteSize

Returns

System.Boolean

ByteSize.operator ++(ByteSize) Operator

public static Humanizer.Bytes.ByteSize operator ++(Humanizer.Bytes.ByteSize b);

Parameters

b ByteSize

Returns

ByteSize

ByteSize.operator !=(ByteSize, ByteSize) Operator

public static bool operator !=(Humanizer.Bytes.ByteSize b1, Humanizer.Bytes.ByteSize b2);

Parameters

b1 ByteSize

b2 ByteSize

Returns

System.Boolean

ByteSize.operator <(ByteSize, ByteSize) Operator

public static bool operator <(Humanizer.Bytes.ByteSize b1, Humanizer.Bytes.ByteSize b2);

Parameters

b1 ByteSize

b2 ByteSize

Returns

System.Boolean

ByteSize.operator <=(ByteSize, ByteSize) Operator

public static bool operator <=(Humanizer.Bytes.ByteSize b1, Humanizer.Bytes.ByteSize b2);

Parameters

b1 ByteSize

b2 ByteSize

Returns

System.Boolean

ByteSize.operator -(ByteSize, ByteSize) Operator

public static Humanizer.Bytes.ByteSize operator -(Humanizer.Bytes.ByteSize b1, Humanizer.Bytes.ByteSize b2);

Parameters

b1 ByteSize

b2 ByteSize

Returns

ByteSize

ByteSize.operator -(ByteSize) Operator

public static Humanizer.Bytes.ByteSize operator -(Humanizer.Bytes.ByteSize b);

Parameters

b ByteSize

Returns

ByteSize