
نوشته شده توسط
رامین مرادی
ممنون دوست عزیز.ولی کلا به تابع SelectAll() گیر میده
Error 5 Cannot find all types required by the 'async' modifier. Are you targeting the wrong framework version, or missing a reference to an assembly?
فریم ورک پروژم هم 4 هست.
به await هم گیر میده
Error 2 The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'.
به اکسپشن هم گیر میده.

با سلام
ارور Error 5 Cannot find all types required by the 'async' modifier. Are you targeting the wrong framework version, or missing a reference to an assembly?
طبق ارور دات نت تنظیم نیست و باید روی 4.5 به بعد قرار بدید
Error 2 The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'.
این خطا هم میگه بدلیل اینکه async ی وجود نداره await ی هم نخواهد بود.
یک مثال از async :
private Task<string> DoWork()
{
return Task.Run(() =>
{
System.Threading.Thread.Sleep(10000);
return "Done.";
});
}
private async void CallButton_Click(object sender, EventArgs e)
{
this.Text = await DoWork();
}
موفق باشید