I need to find out time and memory consumed by simple console C# program.
.Net framework has Stopwatch utility to fullfil the first task,
Stopwatch sw = new Stopwatch();
sw.Start();
Process process = Process.GetCurrentProcess();
long memoryUsedInBytes = process.WorkingSet64;
//do something
sw.Stop();
Console.WriteLine(sw.Elapsed.Milliseconds + "ms elapsed.\n" + memoryUsedInBytes/1000 + " KB consumed");
Do we have some thing as simple as this in the framework to find memory consumed by simple console program, without using advanced diagnostic techniques.
EDIT: appending memory used code, as answered below, by Habib.
You may get the current process and then using the property WorkingSet64 you can get the size in bytes.
Process.WorkingSet64 Property – MSDN
also