I am making an Image Steganography project for my college. I have finished the project and have kept several different algorithms for hiding data in images.
What I want
This is a useful extension method for Stopwatch:
public static class StopwatchExt
{
public static string GetTimeString(this Stopwatch stopwatch, int numberofDigits = 1)
{
double time = stopwatch.ElapsedTicks / (double)Stopwatch.Frequency;
if (time > 1)
return Math.Round(time, numberofDigits) + " s";
if (time > 1e-3)
return Math.Round(1e3 * time, numberofDigits) + " ms";
if (time > 1e-6)
return Math.Round(1e6 * time, numberofDigits) + " µs";
if (time > 1e-9)
return Math.Round(1e9 * time, numberofDigits) + " ns";
return stopwatch.ElapsedTicks + " ticks";
}
}
Use it like this:
Stopwatch stopwatch = Stopwatch.StartNew();
//Call your method here
stopwatch.Stop();
Console.WriteLine(stopwatch.GetTimeString());