Create new binary file (specific folder)
...
Flush and close file
C# uses a concept called streams for binary input/output.
Mandatory literature: http://msdn.microsoft.com/en-us/library/k3352a4t(v=vs.110).aspx
Both techniques are demonstrated on MSDN.
Empty/delete file, if it already exists
Well, actually, you only have to check whether a file exists if you don't wish to overwrite it.
Mark start-time (millisecond precision)
...
Mark end-time (millisecond precision)
...
Output the time it took to write all 10 GB of data (end time - start time)
Output number of bytes per second.
Look around the System.Diagnostics
namespace.
Write 10 GB of dummy data into file, as fast as possible. (Write data as chunks of 1024 byte dummy data, continue untill 10 GB has been written)
Finally, the meat of the program...
Spoiler alert!
You'll have to write a loop that writes 1024 bytes on every iteration until the total sum of bytes written reaches 10GB.
Below is a code example, but without error checking (since it's not a requirement). In the real world, you would obviously write code that handles exceptions too.
using (var fileStream = File.OpenWrite(path))
{
double fileSize = Math.Pow(10, 10); // 10 GB
int bufferSize = 1024; // 1KB
byte[] buffer = new byte[bufferSize]; // Create an array of zero's
for (int written = 0; written < fileSize; written += bufferSize)
{
// Write 1024 bytes (all zero's: 000000000000...0)
fileStream.Write(
array: buffer,
offset: 0,
count: bufferSize);
}
/* Optional inside a "using" block: */ fileStream.Flush();
}