Class ByteCapacity
Class for specifying a binary size, with units
public class ByteCapacity : IEquatable<ByteCapacity>
- Inheritance
-
ByteCapacity
- Implements
- Inherited Members
Constructors
ByteCapacity(long)
public ByteCapacity(long bytes)
Parameters
bytes
long
Methods
B(long)
Specify an amount in bytes
public static ByteCapacity B(long bytes)
Parameters
bytes
longThe size, in bytes
Returns
Equals(ByteCapacity?)
Returns a value indicating whether this instance is equal to a specified ByteCapacity value.
public bool Equals(ByteCapacity? obj)
Parameters
obj
ByteCapacityAn object to compare with this instance.
Returns
- bool
true if obj has the same value as this instance; otherwise, false.
Equals(object?)
Returns a value indicating whether this instance is equal to a specified ByteCapacity value.
public override bool Equals(object? obj)
Parameters
obj
objectAn object to compare with this instance.
Returns
- bool
true if obj is an instance of ByteCapacityand equals the value of this instance; otherwise, false.
Gb(long)
Specify an amount, in gigabytes
public static ByteCapacity Gb(long gigabytes)
Parameters
gigabytes
longThe size, in gigabytes
Returns
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer hash code.
Kb(long)
Specify an amount, in kilobytes
public static ByteCapacity Kb(long kilobytes)
Parameters
kilobytes
longThe size, in kilobytes
Returns
Mb(long)
Specify an amount, in megabytes
public static ByteCapacity Mb(long megabytes)
Parameters
megabytes
longThe size, in megabytes
Returns
Parse(string)
Parse a string into a ByteCapacity
public static ByteCapacity Parse(string value)
Parameters
value
stringThe value, as string
Returns
Tb(long)
Specify an amount, in terabytes
public static ByteCapacity Tb(long terabytes)
Parameters
terabytes
longThe size, in terabytes
Returns
Operators
explicit operator ByteCapacity(string)
Explicitly convert a string into a ByteCapacity
public static explicit operator ByteCapacity(string value)
Parameters
value
stringThe value, as string
Returns
implicit operator long(ByteCapacity)
Cast a ByteCapacity into a long
public static implicit operator long(ByteCapacity value)
Parameters
value
ByteCapacityThe value
Returns
- long
The total number of bytes.