rss
twitter
facebook

Home

ConvertToKbAndMb

public void MssConvertToKbAndMb(string ssbytes, out string ssKb, out string ssMb)
{
            ssKb = string.Empty;
            ssMb = string.Empty;

            // Convert bytes to megabytes.
            double megabytes1 = ConvertBytesToMegabytes(double.Parse(ssbytes));

            ssMb = Math.Round(megabytes1, 2).ToString() + " Mb";

            // Convert bytes to kilobytes.
            double kilobytes = ConvertBytesToKilobytes(double.Parse(ssbytes));

            // Write the result.
            ssKb = Math.Round(kilobytes).ToString() + " Kb";


            // TODO: Write implementation for action
        } // MssConvertToKbAndMb


        static double ConvertBytesToMegabytes(double bytes)
        {
            return (bytes / 1024f) / 1024f;
        }

        static double ConvertBytesToKilobytes(double bytes)
        {
            return bytes / 1024f;
        }

0 comentários:

 
Powered by Blogger