59
1
using System;
2
using System.Diagnostics;
3
4
public class Program
5
{
6
public static void Main()
7
{
8
int ttlcnt = 228394393;
9
int pct = 0;
10
int i = 0;
11
12
13
Stopwatch sw = new Stopwatch();
14
15
Console.WriteLine("double conversion");
16
sw.Start();
17
pct = (int)(100 * ((double)ttlcnt / i)); //~16,800 ticks //17,020 ticks in NETt4.6
18
sw.Stop();
19
Console.WriteLine("pct=" + pct.ToString()+" in ticks="+sw.ElapsedTicks);
20
21
Console.WriteLine("try catch division");
22
sw.Start();
23
try
24
{
Cached Result