Click here to Skip to main content
14,238,485 members
Articles » Languages » C# » How To » Revisions

Await Tasks in C#4 using Iterators

Rate this:
4.97 (30 votes)
Please Sign up or sign in to vote.
4.97 (30 votes)
29 Aug 2013CPOL
Write synchronous-looking asynchronous methods without async/await in Visual Studio 2010.



Compare Revision Minor Date Status Editor
20 - publicly available No 29-Aug-13 13:25 Available Smitha Nishant
Updates in content.
19 No 29-Aug-13 12:25 Pending Keith L Robertson
Oops. Fixed code with unescaped angle brackets.
18 No 29-Aug-13 11:11 Pending Keith L Robertson
Added Await with Try/Catch section, some ToTask() fixes, other minor edits.
16 No 22-Jan-13 2:00 Pending Keith L Robertson
Minor rewording in the Differences section
12 No 8-Dec-12 16:23 Pending Keith L Robertson
Change word from "unavailable" to "unsupported"
11 No 8-Dec-12 11:17 Pending Keith L Robertson
Added concession that the unsupported Async CTP may satisfy some customers.
9 No 8-Dec-12 6:30 Pending Keith L Robertson
Clarified who article does not apply to; expanded introduction to download code; added license info into dowload sample code.
7 No 7-Dec-12 16:40 Pending Keith L Robertson
Removed highbrow-sounding language; added paragraph introducing the download sample; other minor edits esp. the final paragraph.
6 No 7-Dec-12 3:29 Available Smitha Nishant
Updates in content.
5 No 7-Dec-12 2:53 Pending Keith L Robertson
Clarified what's iterated; added one "pro" bullet point to attempt #2.
4 No 7-Dec-12 2:34 Pending Keith L Robertson
Changed "goto" to "yield break"
2 No 6-Dec-12 15:28 Pending Keith L Robertson
Minor spelling correction
1 No 6-Dec-12 15:21 Pending Keith L Robertson
Initial creation


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Keith L Robertson
Software Developer (Senior) AirWatch, LLC
United States United States
Keith started programming in 8th grade in BASIC, then in Z80 (TRS-80) and 6502 (Apple II) assembly. In high school he disassembled Apple DOS and Basic to see how they worked and wrote a program to teach chess openings. At the University of Texas at Austin, Keith completed a newly-created Honors Program for entering CS students, then taught Pascal to other students before graduating in 1988 with a Bachelor of Science in Computer Science, with only three other students receiving the same degree. (Prior to that year, UT had offered only a BA for CS students.) He completed formal education with a Master of Computer Science degree from the University of Virginia.

Keith has worked with many different companies, often on a contract/consulting basis, in C++, Smalltalk, Java, and C#, developing applications for the desktop, client server, enterprise integration, and finally for the web. He currently enjoys his job at AirWatch building integration and web components for Mobile Device Management.

Passionate about software development, Keith's main non-work interests are in language design, compiler construction, and framework development. He also enjoys chess and jogging. Keith lives in Atlanta, GA with his wife and young son.


105 bookmarked