From 80eb66e595d31f66b8403ed5266ddf3e0697a1dd Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch> Date: Tue, 13 Feb 2018 00:19:31 +0100 Subject: [PATCH] Add wrapper method for megabytes to human readable. Refers to #24 --- ATxCommon/Conv.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ATxCommon/Conv.cs b/ATxCommon/Conv.cs index 7d95912..dd355f8 100644 --- a/ATxCommon/Conv.cs +++ b/ATxCommon/Conv.cs @@ -16,7 +16,16 @@ order++; numBytes /= 1024; } + return $"{numBytes:0.#} {suffixes[order]}"; } + + /// <summary> + /// Wrapper to convert megabytes into human-readable size string. + /// See <see cref="BytesToString"/> for more details. + /// </summary> + public static string MegabytesToString(long megaBytes) { + return BytesToString(megaBytes * MegaBytes); + } } -} +} \ No newline at end of file -- GitLab