The yield return op code is one of my favorites in its neatness ( and,
I think, is unique to C# ). Here is an extension method which returns
an IEnumerable interface to a sequence of Int which is parsed from a
string of comma separated numbers:

public static IEnumerable<int?> ParseLine(this string InLine)

Steve: The yield statement goes back a long time. I couldn't tell you
when a programming language first had that kind of feature, but C#
definitely was not the first. Another commonly used modern language
with
yield is Python. But in Python, I wouldn't bother using yield for that
kind of thing. To convert a comma separated string of numbers into a
list, I'd code something like this:

Folks, are we still discussing RPG here (on this RPG list)? I cannot tell
anymore.

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"Every time a lawyer writes something, he is not writing for posterity, he
is writing so that endless others of his craft can make a living out of
trying to figure out what he said."
-- Will Rogers




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.