static Task <string> FactorAsync(int number) { PrimeHelper helper = new PrimeHelper(); List <int> factors = helper.GetPrimeFactors(number); return(Task.FromResult($"{number} = {string.Join("*", factors)}")); }
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; }
private Task <string> FactorAsync() { PrimeHelper helper = new PrimeHelper(); int number = int.Parse(txtNumber.Text); return(Task.Factory.StartNew <string>(() => string.Join("*", helper.GetPrimeFactors(number)) )); }
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)); } )); }