Cannot implicitly convert type 'int' to '…Tasks<int>'
问题 if this is async, it'll return with no error, why is it throwing an error without being async, async is worthless in this operation. public Task<int> countUp() { string compare = txtTag.Text; int count = 0; for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (compare == dataGridView1[0, i].Value.ToString()) { BeginInvoke(new Action(() => { count++; txtCount.Text = count.ToString(); })); } } return count; } 回答1: Well, you could return a completed Task: return Task.FromResult(count); http:/