473,326 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Language Enhancement Idea

I don't know if this is the correct forum to propose a new feature for the
C# languange, but I thought I would do so anyway.

I was working on a project and thought of a feature that would possibly
help many developers. It was the adition of a new loop that crossed a
foreach and a do loop. The syntax would be something like:

foreach ( object obj in collection )
{
statement;
} while ( condition == true );
Nov 15 '05 #1
4 1060
"Matt Osborne" <pr*****@anti-spam.org> wrote in message
news:56**************@newssvr25.news.prodigy.com.. .
I don't know if this is the correct forum to propose a new feature for the
C# languange, but I thought I would do so anyway.

I was working on a project and thought of a feature that would possibly
help many developers. It was the adition of a new loop that crossed a
foreach and a do loop. The syntax would be something like:

foreach ( object obj in collection )
{
statement;
} while ( condition == true );


Since it is trivial to get the same effect with:

foreach (object obj in collection)
{
statement;
if (condition == false)
break;
}

I'd say it is not worth adding another construct to the language.

Regards,
Sami
Nov 15 '05 #2
The more difficult, but also more elegant way, would be to write a new
IEnumerator for what you are trying to accompish. I have several
enumerators that filter and do things to other enumerators. I'll have to
think about it, but it may be possible to write an enumerator with some sort
of break condition.

I'll get back if I find anything elegant.

This will of course be easier with C# 2.0's iterators...but I digress.

--Matthew W. Jackson

"Sami Vaaraniemi" <sa***************@jippii.fi> wrote in message
news:bs**********@phys-news1.kolumbus.fi...
"Matt Osborne" <pr*****@anti-spam.org> wrote in message
news:56**************@newssvr25.news.prodigy.com.. .
I don't know if this is the correct forum to propose a new feature for the C# languange, but I thought I would do so anyway.

I was working on a project and thought of a feature that would possibly
help many developers. It was the adition of a new loop that crossed a
foreach and a do loop. The syntax would be something like:

foreach ( object obj in collection )
{
statement;
} while ( condition == true );


Since it is trivial to get the same effect with:

foreach (object obj in collection)
{
statement;
if (condition == false)
break;
}

I'd say it is not worth adding another construct to the language.

Regards,
Sami

Nov 15 '05 #3
Maybe the OP would give us some more
info, like maybe what advantages this has
over the way just mentioned in this reply?

"Sami Vaaraniemi" <sa***************@jippii.fi> wrote in message
news:bs**********@phys-news1.kolumbus.fi...
"Matt Osborne" <pr*****@anti-spam.org> wrote in message
news:56**************@newssvr25.news.prodigy.com.. .
I don't know if this is the correct forum to propose a new feature for the C# languange, but I thought I would do so anyway.

I was working on a project and thought of a feature that would possibly
help many developers. It was the adition of a new loop that crossed a
foreach and a do loop. The syntax would be something like:

foreach ( object obj in collection )
{
statement;
} while ( condition == true );


Since it is trivial to get the same effect with:

foreach (object obj in collection)
{
statement;
if (condition == false)
break;
}

I'd say it is not worth adding another construct to the language.

Regards,
Sami

Nov 15 '05 #4
The upcomming "annonymous methods" feature may provide some of the
functionality you are looking for.

"Matt Osborne" <pr*****@anti-spam.org> wrote in message
news:56**************@newssvr25.news.prodigy.com.. .
I don't know if this is the correct forum to propose a new feature for the
C# languange, but I thought I would do so anyway.

I was working on a project and thought of a feature that would possibly
help many developers. It was the adition of a new loop that crossed a
foreach and a do loop. The syntax would be something like:

foreach ( object obj in collection )
{
statement;
} while ( condition == true );

Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

35
by: Dave Allison | last post by:
Oh no, not another "check out my cool new language" posting :-) For about 5 years now, I have been developing a scripting/prototyping language that is now available on the net. It's called...
22
by: WXS | last post by:
Sometimes a method in a class requires the use of class instance variables/fields that will not be used outside of the method itself. Currently this means you must create a instance field in the...
6
by: WXS | last post by:
I know this sounds contrary to the idea of an interface, but read this and see what you think. ----------------------------------------------------------------------------------------- It would be...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.