yield statement in c# 2.0

  • Thread starter Thread starter al3x
  • Start date Start date
A

al3x

hi...
in c# 2.0 will be possible use a new keywork "yield"...

I would like to know if there is an algorithm that implements yield
statement in a c# or c++

thanks

bye
Sandro
 
C# 2.0: supports yield (in an iterator)
C# < 2.0: no
C++: no
VB: no

In the languages without language-level iterator support, you'll need to
write the enumerator code by hand.
 
In the languages without language-level iterator support, you'll need to
write the enumerator code by hand.

I know this...
I think that c# compiler translate the yield statement in an
enumerator!!! I would like to know how happen this!!! A translation
algorithm?

thank you Mickey

bye

Sandro
 
I think that c# compiler translate the yield statement in an
enumerator!!! I would like to know how happen this!!! A translation
algorithm?

I know this answer won't help you much, but... I found an example completely
worked out in one of the PPT files from the PDC2003. I don't really remember
which one, though. You might be able to find it by using the session name.
 
It is implemented as an Enumerator because thats what it is and its
also backward compatible with lesser runtimes.
 
It converts the iterator into an implementation of IEnumerator or
IEnumerable, just as if you had written the code yourself (or better in some
cases :)
 
Back
Top