using System; using System.IO; using System.Diagnostics; namespace SpeedTest { public class testFileCopySpeed { public int Get(string sourceFile, string destinationFile) { Stopwatch testStopwatch = new Stopwatch(); testStopwatch.Start(); File.Copy(sourceFile, destinationFile, true); testStopwatch.Stop(); FileInfo someFileInfo = new FileInfo(destinationFile); long fileByteSize = someFileInfo.Length; File.Delete(destinationFile); return (int)((Convert.ToDouble(someFileInfo.Length) / (Convert.ToDouble(testStopwatch.ElapsedMilliseconds) / 1000)) / 1024); } } }
Комментариев нет:
Отправить комментарий