Example #1
0
        static Task <string> FactorAsync(int number)
        {
            PrimeHelper helper  = new PrimeHelper();
            List <int>  factors = helper.GetPrimeFactors(number);

            return(Task.FromResult($"{number} = {string.Join("*", factors)}"));
        }
Example #2
0
        private void OnClick(object sender, RoutedEventArgs e)
        {
            PrimeHelper helper = new PrimeHelper();
            int         number = int.Parse(txtNumber.Text);
            string      result = string.Join("*", helper.GetPrimeFactors(number));

            lblResult.Content = result;
        }
Example #3
0
        private Task <string> FactorAsync()
        {
            PrimeHelper helper = new PrimeHelper();
            int         number = int.Parse(txtNumber.Text);

            return(Task.Factory.StartNew <string>(() =>
                                                  string.Join("*", helper.GetPrimeFactors(number))
                                                  ));
        }
Example #4
0
        private Task <string> FactorAsync()
        {
            PrimeHelper helper = new PrimeHelper();
            int         number = int.Parse(txtNumber.Text);

            return(Task.Factory.StartNew <string>(() =>
            {
                Trace.WriteLine($"During - {Thread.CurrentThread.ManagedThreadId}");

                return string.Join("*", helper.GetPrimeFactors(number));
            }
                                                  ));
        }