c# - Convert Task<String> to String in Windows 8 apps -
i writing windows 8 app. have code :
public async task<string> readweb() { var uri = new uri(@"http://stackoverflow.com/"); var httpclient = new httpclient(); var data = await httpclient.getstringasync(uri); string text = data; return text; }
i want web-data string data = readweb();
error "cannot convert task string". me! thanks!
do this,
public async task<string> readweb() { var uri = new uri(@"http://stackoverflow.com/"); var httpclient = new httpclient(); var data = await httpclient.getstringasync(uri); string text = data; return text; } private async void something() { var data = await readweb(); }
Comments
Post a Comment