From 6831233bd3426b87a737f44f8067ce7c48d69c0b Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch> Date: Wed, 7 Mar 2018 23:25:07 +0100 Subject: [PATCH] Add const and method for converting GigaBytes. Refers to #24 --- ATxCommon/Conv.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ATxCommon/Conv.cs b/ATxCommon/Conv.cs index dd355f8..6ad74cb 100644 --- a/ATxCommon/Conv.cs +++ b/ATxCommon/Conv.cs @@ -3,6 +3,7 @@ public static class Conv { public const int MegaBytes = 1024 * 1024; + public const int GigaBytes = MegaBytes * 1024; /// <summary> /// Convert bytes into a human-readable string with the appropriate suffix (up to TB). @@ -27,5 +28,13 @@ public static string MegabytesToString(long 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 -- GitLab