wpf - File.OpenRead and GetFileAsync -


what's difference between:

applicationdata.current.localfolder.getfileasync("myfile.txt"); 

and

file.openread( applicationdata.current.localfolder.path + @"\myfile.txt" ); 

both can used, getfileasync not block execution until full file returned.

to use need put in await such as:

var result = await applicationdata.current.localfolder.getfileasync("myfile.txt");

why use await?

async installs overhead in handling things timeouts , not in background foreground developer not have directly deal it.

primarily use not block gui operations or when there need load multiple facets of data not rely on synchronous chaining of data extractions.

to understand start reading stephen cleary's blog article async , await


Comments