Monday, March 18, 2013

C# Start New Process

This is how it's done:http://stackoverflow.com/questions/258416/shellexecute-equivalent-in-net

If you need to start multiple processes asynchronously, you'd need to first start multiple threads and then within each thread, each process is started.

Reference for this: http://www.codeproject.com/Articles/25983/How-to-Execute-a-Command-in-C

How to add arguments: http://msdn.microsoft.com/en-sg/library/system.diagnostics.processstartinfo.arguments.aspx

Tuesday, March 12, 2013

C# Getting Time Since Epoch

Many things are simpler in C# than e.g. in Java, but getting the Epoch time is an exception, and this is how it's done.


TimeSpan timeSpan = DateTime.UtcNow - new DateTime(1970, 1, 1);
double currentTime = timeSpan.TotalSeconds;