using System;
using System.Diagnostics;
// Using Library
namespace get_execute_time_of_c_sharp_function
{
class
A
//create class
{
int n = 5;
int k =5;
public
void table()
//create function
{
Console.WriteLine("Table
Of 5 is:");
var sw =
Stopwatch.StartNew();
//call to startNew() function
through Stopwatch class library
for (int
i = 1; i <= 10; i++)
//create for
loop
{
n = k;
n = n * i;
Console.WriteLine(n);
//show table
}
sw.Stop();
//call to stop() function for
Stopwatch class library
Console.Write("Looping
Time is:");
//show execute
time of loop in milisecond
Console.WriteLine((sw.Elapsed.TotalMilliseconds).ToString("0.00
Milli Second"));
}
}
class
Program
{
static
void Main(string[]
args)
{
A obj
= new
A();
//create class object
obj.table();
// call to table() function
Console.ReadLine();
}
}
}