Table of Contents

Struct ByteSize

Namespace
Backdash.Data
Assembly
Backdash.dll

Represents a byte size value

public readonly struct ByteSize : IComparable<ByteSize>, IFormattable, IUtf8SpanFormattable, IComparisonOperators<ByteSize, ByteSize, bool>, IEqualityOperators<ByteSize, ByteSize, bool>, IAdditionOperators<ByteSize, ByteSize, ByteSize>, ISubtractionOperators<ByteSize, ByteSize, ByteSize>, IDivisionOperators<ByteSize, long, ByteSize>, IDivisionOperators<ByteSize, double, ByteSize>, IMultiplyOperators<ByteSize, long, ByteSize>, IIncrementOperators<ByteSize>, IDecrementOperators<ByteSize>, IEquatable<ByteSize>
Implements
Inherited Members

Constructors

ByteSize(long)

Represents a byte size value

public ByteSize(long ByteCount)

Parameters

ByteCount long

Properties

ByteCount

public long ByteCount { get; init; }

Property Value

long

GibiBytes

Gets the number of GibiBytes represented by this object.

public double GibiBytes { get; }

Property Value

double

GigaBytes

Gets the number of GigaBytes represented by this object.

public double GigaBytes { get; }

Property Value

double

KibiBytes

Gets the number of KibiBytes represented by this object.

public double KibiBytes { get; }

Property Value

double

KiloBytes

Gets the number of KiloBytes represented by this object.

public double KiloBytes { get; }

Property Value

double

MebiBytes

Gets the number of MebiBytes represented by this object.

public double MebiBytes { get; }

Property Value

double

MegaBytes

Gets the number of MegaBytes represented by this object.

public double MegaBytes { get; }

Property Value

double

One

Gets the byte value 1.

public static ByteSize One { get; }

Property Value

ByteSize

TebiBytes

Gets the number of TebiBytes represented by this object.

public double TebiBytes { get; }

Property Value

double

TeraBytes

Gets the number of TeraBytes represented by this object.

public double TeraBytes { get; }

Property Value

double

Zero

Gets the byte value 0.

public static ByteSize Zero { get; }

Property Value

ByteSize

Methods

CompareTo(ByteSize)

public int CompareTo(ByteSize other)

Parameters

other ByteSize

Returns

int

Deconstruct(out long)

public void Deconstruct(out long ByteCount)

Parameters

ByteCount long

Equals(ByteSize)

public bool Equals(ByteSize other)

Parameters

other ByteSize

Returns

bool

Equals(object)

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

FromBytes(long)

Returns new ByteSize with value bytes

public static ByteSize FromBytes(long value)

Parameters

value long

Number of bytes

Returns

ByteSize

FromGibiBytes(double)

Returns new ByteSize with value gibi-bytes

public static ByteSize FromGibiBytes(double value)

Parameters

value double

Number of gibi-bytes

Returns

ByteSize

FromGigaBytes(double)

Returns new ByteSize with value giga-bytes

public static ByteSize FromGigaBytes(double value)

Parameters

value double

Number of giga-bytes

Returns

ByteSize

FromKibiBytes(double)

Returns new ByteSize with value kibi-bytes

public static ByteSize FromKibiBytes(double value)

Parameters

value double

Number of kibi-bytes

Returns

ByteSize

FromKiloByte(double)

Returns new ByteSize with value kilo-bytes

public static ByteSize FromKiloByte(double value)

Parameters

value double

Number of kilo-bytes

Returns

ByteSize

FromMebiBytes(double)

Returns new ByteSize with value mebi-bytes

public static ByteSize FromMebiBytes(double value)

Parameters

value double

Number of mebi-bytes

Returns

ByteSize

FromMegaBytes(double)

Returns new ByteSize with value mega-bytes

public static ByteSize FromMegaBytes(double value)

Parameters

value double

Number of mega-bytes

Returns

ByteSize

FromTebiBytes(double)

Returns new ByteSize with value gibi-bytes

public static ByteSize FromTebiBytes(double value)

Parameters

value double

Number of tebi-bytes

Returns

ByteSize

FromTeraBytes(double)

Returns new ByteSize with value tera-bytes

public static ByteSize FromTeraBytes(double value)

Parameters

value double

Number of tera-bytes

Returns

ByteSize

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

Returns the string representation for the current byte size

public override string ToString()

Returns

string

ToString(Measure)

Returns the string representation for the current byte size as measure

public string ToString(ByteSize.Measure measure)

Parameters

measure ByteSize.Measure

Returns

string

ToString(string?)

public string ToString(string? format)

Parameters

format string

Returns

string

ToString(string?, IFormatProvider?)

public string ToString(string? format, IFormatProvider? formatProvider)

Parameters

format string
formatProvider IFormatProvider

Returns

string

TryFormat(Span<byte>, out int, ReadOnlySpan<char>, IFormatProvider?)

public bool TryFormat(Span<byte> utf8Destination, out int bytesWritten, ReadOnlySpan<char> format, IFormatProvider? provider)

Parameters

utf8Destination Span<byte>
bytesWritten int
format ReadOnlySpan<char>
provider IFormatProvider

Returns

bool

Operators

explicit operator ByteSize(byte)

Returns new ByteSize with value bytes

public static explicit operator ByteSize(byte value)

Parameters

value byte

Returns

ByteSize

explicit operator ByteSize(short)

Returns new ByteSize with value bytes

public static explicit operator ByteSize(short value)

Parameters

value short

Returns

ByteSize

explicit operator ByteSize(int)

Returns new ByteSize with value bytes

public static explicit operator ByteSize(int value)

Parameters

value int

Returns

ByteSize

explicit operator ByteSize(long)

Returns new ByteSize with value bytes

public static explicit operator ByteSize(long value)

Parameters

value long

Returns

ByteSize

explicit operator ByteSize(sbyte)

Returns new ByteSize with value bytes

public static explicit operator ByteSize(sbyte value)

Parameters

value sbyte

Returns

ByteSize

explicit operator ByteSize(ushort)

Returns new ByteSize with value bytes

public static explicit operator ByteSize(ushort value)

Parameters

value ushort

Returns

ByteSize

explicit operator ByteSize(uint)

Returns new ByteSize with value bytes

public static explicit operator ByteSize(uint value)

Parameters

value uint

Returns

ByteSize

operator *(long, ByteSize)

public static ByteSize operator *(long left, ByteSize right)

Parameters

left long
right ByteSize

Returns

ByteSize

Explicit Interface Implementations

operator +(ByteSize, ByteSize)

static ByteSize operator +(ByteSize left, ByteSize right)

Parameters

left ByteSize
right ByteSize

Returns

ByteSize

operator --(ByteSize)

static ByteSize operator --(ByteSize value)

Parameters

value ByteSize

Returns

ByteSize

operator /(ByteSize, double)

static ByteSize operator /(ByteSize left, double right)

Parameters

left ByteSize
right double

Returns

ByteSize

operator /(ByteSize, long)

static ByteSize operator /(ByteSize left, long right)

Parameters

left ByteSize
right long

Returns

ByteSize

operator ==(ByteSize, ByteSize)

static bool operator ==(ByteSize left, ByteSize right)

Parameters

left ByteSize
right ByteSize

Returns

bool

operator >(ByteSize, ByteSize)

static bool operator >(ByteSize left, ByteSize right)

Parameters

left ByteSize
right ByteSize

Returns

bool

operator >=(ByteSize, ByteSize)

static bool operator >=(ByteSize left, ByteSize right)

Parameters

left ByteSize
right ByteSize

Returns

bool

operator ++(ByteSize)

static ByteSize operator ++(ByteSize value)

Parameters

value ByteSize

Returns

ByteSize

operator !=(ByteSize, ByteSize)

static bool operator !=(ByteSize left, ByteSize right)

Parameters

left ByteSize
right ByteSize

Returns

bool

operator <(ByteSize, ByteSize)

static bool operator <(ByteSize left, ByteSize right)

Parameters

left ByteSize
right ByteSize

Returns

bool

operator <=(ByteSize, ByteSize)

static bool operator <=(ByteSize left, ByteSize right)

Parameters

left ByteSize
right ByteSize

Returns

bool

operator *(ByteSize, long)

static ByteSize operator *(ByteSize left, long right)

Parameters

left ByteSize
right long

Returns

ByteSize

operator -(ByteSize, ByteSize)

static ByteSize operator -(ByteSize left, ByteSize right)

Parameters

left ByteSize
right ByteSize

Returns

ByteSize