Skip to content
Snippets Groups Projects
Commit 6831233b authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Add const and method for converting GigaBytes.

Refers to #24
parent e676cc01
Branches
Tags
No related merge requests found
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
public static class Conv public static class Conv
{ {
public const int MegaBytes = 1024 * 1024; public const int MegaBytes = 1024 * 1024;
public const int GigaBytes = MegaBytes * 1024;
/// <summary> /// <summary>
/// Convert bytes into a human-readable string with the appropriate suffix (up to TB). /// Convert bytes into a human-readable string with the appropriate suffix (up to TB).
...@@ -27,5 +28,13 @@ ...@@ -27,5 +28,13 @@
public static string MegabytesToString(long megaBytes) { public static string MegabytesToString(long megaBytes) {
return BytesToString(megaBytes * MegaBytes); return BytesToString(megaBytes * MegaBytes);
} }
/// <summary>
/// Wrapper to convert gigabytes into human-readable size string.
/// See <see cref="BytesToString"/> for more details.
/// </summary>
public static string GigabytesToString(long gigaBytes) {
return BytesToString(gigaBytes * GigaBytes);
}
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment