Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string        res             = string.Empty;
            int           conversionCount = Convert.ToInt32(numericUpDown1.Value);
            TimeSpan      ts1;
            DateTime      t1, t2;
            StringBuilder sb           = new StringBuilder();
            int           i            = 0;
            int           countryIndex = 0;



            t1           = DateTime.Now;
            countryIndex = 0; // StringLib.GetCRandomNum(0, arr_isos.Length);
            for (i = 0; i < conversionCount; i++)
            {
                res = ISO2ToFIPSConvertor.GetFipsCode(arr_isos[countryIndex]);

                countryIndex++;
                if (countryIndex >= arr_isos.Length)
                {
                    countryIndex = 0;
                }
            }
            t2  = DateTime.Now;
            ts1 = t2 - t1;
            sb.Append(String.Format("{0} ISO2ToFIPSConvertor lookups done in {1} ms.", i, ts1.TotalMilliseconds));



            t1           = DateTime.Now;
            countryIndex = StringLib.GetCRandomNum(0, arr_fips.Length);
            for (i = 0; i < conversionCount; i++)
            {
                res = FIPSToISO2Convertor.GetISO2Code(arr_fips[countryIndex]);

                countryIndex++;
                if (countryIndex >= arr_fips.Length)
                {
                    countryIndex = 0;
                }
            }
            t2  = DateTime.Now;
            ts1 = t2 - t1;
            sb.Append(String.Format("{0}{1} FIPSToISO2Convertor lookups done in {2} ms.", Environment.NewLine, i, ts1.TotalMilliseconds));



            textBox2.Text = sb.ToString();
        }