Geeks With Blogs

News
WinToolZone - Spelunking Microsoft Technologies
I work as a developer on the Common Language Runtime (CLR) team, specifically in the areas of exception handling and CLR hosting.
Disclaimer

The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion. Inappropriate comments will be deleted at the authors discretion. All code samples are provided "AS IS" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

Inside and Out... An attempt to understand technology better...

When working with Iterators in the PDC build of VS Whidbey, one would implement an Iterator as shown below:

public IEnumerator GetEnumerator()
{
     while(index<count)
             yield arrData[index++];
}

This has changed to the following in the VS 2005 Technical Preview:

public IEnumerator GetEnumerator()
{
     while(index<count)
             yield return arrData[index++];
}

There is the addition of the return keyword.

Posted on Wednesday, May 12, 2004 12:09 PM .NET Framework | Back to top


Comments on this post: Yield syntax change in VS 2005 TechPreview...

# re: Yield syntax change in VS 2005 TechPreview...
Requesting Gravatar...
I believe the change has been to avoid breaking existing code which use yield as a user identifier.
Left by Sanjay Vyas on May 16, 2004 9:57 AM

# re: Yield syntax change in VS 2005 TechPreview...
Requesting Gravatar...
Well, I had tried an existing [PDC Whidbey] code that was like "yield arrData[i]" and that broke under the VS 2005 TechPreview compiler.
Left by Gaurav Khanna on May 16, 2004 10:04 AM

Your comment:
 (will show your gravatar)


Copyright © Gaurav Khanna | Powered by: GeeksWithBlogs.net