PC Review


Reply
Thread Tools Rate Thread

C# equivalent of VB.NET "For Each"

 
 
John Grandy
Guest
Posts: n/a
 
      22nd Mar 2005
What is the C# equivalent to the VB.Net looping structure:

Protected rbl As RadioButtonList

Dim li As ListItem
For Each li In rbl.Items

Next li


 
Reply With Quote
 
 
 
 
Michael A. Covington
Guest
Posts: n/a
 
      22nd Mar 2005
Believe it or not, it's called "foreach".

"John Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
news:(E-Mail Removed)...
> What is the C# equivalent to the VB.Net looping structure:
>
> Protected rbl As RadioButtonList
>
> Dim li As ListItem
> For Each li In rbl.Items
>
> Next li
>



 
Reply With Quote
 
Ajay Kalra
Guest
Posts: n/a
 
      22nd Mar 2005
C# has foreach as well:

http://msdn.microsoft.com/library/de...us/csref/html/
vclrfTheForeachStatement.asp

Any class that implements IEnumerable will support foreach.

--
Ajay Kalra [MVP - VC++]
(E-Mail Removed)


"John Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
news:(E-Mail Removed)...
> What is the C# equivalent to the VB.Net looping structure:
>
> Protected rbl As RadioButtonList
>
> Dim li As ListItem
> For Each li In rbl.Items
>
> Next li
>
>



 
Reply With Quote
 
Tom Porterfield
Guest
Posts: n/a
 
      22nd Mar 2005
On Mon, 21 Mar 2005 21:38:47 -0500, Ajay Kalra wrote:

> Any class that implements IEnumerable will support foreach.


Actually any class with a public GetEnumerator() method that returns an
IEnumerator implementation will support foreach. The class doesn't need to
implement IEnumerable, just have the GetEnumerator() method. There are
times when this subtle difference can be important.
--
Tom Porterfield
 
Reply With Quote
 
QWERTY
Guest
Posts: n/a
 
      22nd Mar 2005
RTFM

On Mon, 21 Mar 2005 18:19:38 -0800, "John Grandy"
<johnagrandy-at-yahoo-dot-com> wrote:

>What is the C# equivalent to the VB.Net looping structure:
>
>Protected rbl As RadioButtonList
>
>Dim li As ListItem
>For Each li In rbl.Items
>
>Next li
>


 
Reply With Quote
 
John Grandy
Guest
Posts: n/a
 
      22nd Mar 2005
Thank you for your very positive statement regarding profesionalism,
camaraderie, the planet, and those who live on it.

"QWERTY" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> RTFM
>
> On Mon, 21 Mar 2005 18:19:38 -0800, "John Grandy"
> <johnagrandy-at-yahoo-dot-com> wrote:
>
>>What is the C# equivalent to the VB.Net looping structure:
>>
>>Protected rbl As RadioButtonList
>>
>>Dim li As ListItem
>>For Each li In rbl.Items
>>
>>Next li
>>

>



 
Reply With Quote
 
Michael A. Covington
Guest
Posts: n/a
 
      22nd Mar 2005

"QWERTY" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> RTFM


He can't look up the statements of one language in the manual of another
language. See the problem? There is no specific "FM" that answers his
question.


 
Reply With Quote
 
Samuel R. Neff
Guest
Posts: n/a
 
      22nd Mar 2005

Actually there is.

Language Equivalents
http://msdn.microsoft.com/library/de...quivalents.asp

Sam


On Tue, 22 Mar 2005 12:50:59 -0500, "Michael A. Covington"
<(E-Mail Removed)> wrote:

>
>"QWERTY" <(E-Mail Removed)> wrote in message
>news:(E-Mail Removed)...
>> RTFM

>
>He can't look up the statements of one language in the manual of another
>language. See the problem? There is no specific "FM" that answers his
>question.
>


B-Line is now hiring one Washington D.C. area VB.NET
developer for WinForms + WebServices position.
Seaking mid to senior level developer. For
information or to apply e-mail resume to
sam_blinex_com.
 
Reply With Quote
 
John Grandy
Guest
Posts: n/a
 
      22nd Mar 2005
Yes yes yes I could have looked it up. But what I never understood about
the "RTFM" people is that it takes them longer to type and submit a "RTFM"
answer than it takes them to read the question in the first place, so if
they are so annoyed by their time being wasted by "obvious questions" then
why do they invest the additional time to respond?

"Samuel R. Neff" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> Actually there is.
>
> Language Equivalents
> http://msdn.microsoft.com/library/de...quivalents.asp
>
> Sam
>
>
> On Tue, 22 Mar 2005 12:50:59 -0500, "Michael A. Covington"
> <(E-Mail Removed)> wrote:
>
>>
>>"QWERTY" <(E-Mail Removed)> wrote in message
>>news:(E-Mail Removed)...
>>> RTFM

>>
>>He can't look up the statements of one language in the manual of another
>>language. See the problem? There is no specific "FM" that answers his
>>question.
>>

>
> B-Line is now hiring one Washington D.C. area VB.NET
> developer for WinForms + WebServices position.
> Seaking mid to senior level developer. For
> information or to apply e-mail resume to
> sam_blinex_com.



 
Reply With Quote
 
Samuel R. Neff
Guest
Posts: n/a
 
      22nd Mar 2005

Because once you get a "how do you do for-each in c#" then you get
"how do you do x" and "how do you do y" and on and on and on.

Looking up answers instead of just posting questions is very
beneficial in that you not only get the answer to your question but
almost always end up learning something else unrelated.

Sam


On Tue, 22 Mar 2005 10:32:42 -0800, "John Grandy"
<johnagrandy-at-yahoo-dot-com> wrote:

>Yes yes yes I could have looked it up. But what I never understood about
>the "RTFM" people is that it takes them longer to type and submit a "RTFM"
>answer than it takes them to read the question in the first place, so if
>they are so annoyed by their time being wasted by "obvious questions" then
>why do they invest the additional time to respond?
>
>"Samuel R. Neff" <(E-Mail Removed)> wrote in message
>news:(E-Mail Removed)...
>>
>> Actually there is.
>>
>> Language Equivalents
>> http://msdn.microsoft.com/library/de...quivalents.asp
>>
>> Sam


B-Line is now hiring one Washington D.C. area VB.NET
developer for WinForms + WebServices position.
Seaking mid to senior level developer. For
information or to apply e-mail resume to
sam_blinex_com.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Querytables WebTables equivalent for InternetExplorer.Application.Document.all()="HTMLTable" dtshedd@yahoo.com Microsoft Excel Programming 3 27th Aug 2009 01:00 AM
Field Names: "LongName", "ShortName", "Code", "Description","Comments" PeteCresswell Microsoft Access 2 25th Feb 2009 11:41 PM
VB.NET equivalent to "classic" VB "DoEvents" =?Utf-8?B?cGNuZXJk?= Microsoft VB .NET 1 13th Jun 2006 04:36 AM
<FORM METHOD="post" onSubmit="return fieldcheck()" name="orientation" action="http://ws-kitty.BU.edu/AT/survey/orientation/script/write.asp" language="JavaScript"> Joeyej Microsoft ASP .NET 0 4th Jun 2004 08:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:35 AM.