Using system. the diagnostics namespace contains classes that can interact with system process Event Logs and performance counters. They are generally used to help diagnose and debug applications. For example, the debug class is used to help groups debug code. The process class can control process access to trace. class can track Code Execution
Process is used to operate local or remote process access. By using process, you can easily start or stop an external process in a hosted environment.
Code
Using system;
Using system. Collections. Generic;
Using system. LINQ;
Using system. text;
Using system. diagnostics;
Namespace testequal
{
Class Program
{
Static void main (string [] ARGs)
{
Process myprocess = new process ();
Myprocess. startinfo. filename = "iexplore.exe ";
Myprocess. startinfo. Arguments = "http://www.baidu.com ";
Myprocess. Start ();
}
}
}
The filename and arguments attributes must be set.
Stopwatch for high-precision detection run time start method indicates start measurement stop means stop measurement reset means stop measurement and reset to 0 finally return measurement time with elapsed
Code
Using system;
Using system. Collections. Generic;
Using system. LINQ;
Using system. text;
Using system. collections;
Using system. diagnostics;
Namespace testequal
{
Class Program
{
Static void main (string [] ARGs)
{
Arraylist mylist = new arraylist ();
Stopwatch watch = stopwatch. startnew ();
For (INT I = 0; I <100000; I ++)
{
Mylist. Add (I );
}
Watch. Stop ();
Console. writeline (WATCH. elapsedmilliseconds );
Console. Readline ();
}
}
}
EventLog provides the method to write and read the Event Logs created and deleted.
Code Using system;
Using system. Collections. Generic;
Using system. LINQ;
Using system. text;
Using system. collections;
Using system. diagnostics;
Namespace testequal
{
Class Program
{
Static void main (string [] ARGs)
{
EventLog mylog = new EventLog ("mylog", ".", "anylog ");
Mylog. writeentry ("It is my log.", eventlogentrytype. Information, 1 );
Foreach (eventlogentry ele in mylog. Entries)
{
Console. writeline (Ele. Message );
}
}
}
}