Tag: Size Summary mat pre private size 0.00 Returns DIV
1 /// <summary>2 ///C # Methods for formatting file sizes3 /// </summary>4 /// <param name= "FileSize" >The size of the file, passed in as a bytes parameter</param>5 /// <returns>formatted value</returns>6 Private Static stringGetFileSize (Longfilesize)7 {8 if(FileSize <0)9 {Ten return "0"; One } A Else if(FileSize >=1024x768*1024x768*1024x768)//file size is greater than or equal to 1024MB - { - return string. Format ("{0:0.00} GB", (Double) FileSize/(1024x768*1024x768*1024x768)); the } - Else if(FileSize >=1024x768*1024x768)//file size is greater than or equal to 1024KB - { - return string. Format ("{0:0.00} MB", (Double) FileSize/(1024x768*1024x768)); + } - Else if(FileSize >=1024x768)//file size is greater than or equal to 1024bytes + { A return string. Format ("{0:0.00} KB", (Double) FileSize/1024x768); at } - Else - { - return string. Format ("{0:0.00} bytes", filesize); - } -}
"C #" C # format File size