Description
The SizeFormat
method is a static extension method in the SandboxSystemExtensions
class. It is used to convert a size in bytes, represented as a System.Int64
, into a human-readable string format. This method is particularly useful for displaying file sizes or data transfer amounts in a more understandable format, such as KB, MB, GB, etc.
Usage
To use the SizeFormat
method, simply call it with a long integer representing the number of bytes you wish to format. The method will return a string that represents the size in a more readable format.
Example
// Example usage of the SizeFormat method
long fileSizeInBytes = 1048576; // 1 MB in bytes
string formattedSize = SandboxSystemExtensions.SizeFormat(fileSizeInBytes);
// formattedSize will be "1 MB"