mirror of https://github.com/quasar/Quasar.git
Moved string array to class-level
Moved string array for file size units to a class-level const string array for performance.
This commit is contained in:
parent
8b20dee5e1
commit
21261270d8
|
@ -9,6 +9,7 @@ public static class Helper
|
|||
{
|
||||
private const string CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
private static readonly Random _rnd = new Random(Environment.TickCount);
|
||||
private const string[] sizes = { "B", "KB", "MB", "GB" };
|
||||
|
||||
public static string GetRandomFilename(int length, string extension)
|
||||
{
|
||||
|
@ -30,7 +31,6 @@ public static string GetRandomName(int length)
|
|||
|
||||
public static string GetFileSize(long size)
|
||||
{
|
||||
string[] sizes = {"B", "KB", "MB", "GB"};
|
||||
double len = size;
|
||||
int order = 0;
|
||||
while (len >= 1024 && order + 1 < sizes.Length)
|
||||
|
|
Loading…
Reference in New Issue