По-русски Notes

Wednesday, June 23, 2004

foreach statement

using <class> is like with <an object> in Pascal. And I think there is a situation where such a feature will be useful.

using <class> is like with <an object> in Pascal. And I think there is a situation where such a feature will be useful.

The foreach statement always involves declaration of a local variable:

foreach( XmlElement element
in doc.SelectNodes(xpath) )
{
Console.WriteLine( "{0} of type {1}",
element.Name,
element.GetAttribute("Type"));
}

How often You name the variable with i? While there is always the variable in the foreach statement it's possible simply omit its name:

foreach( XmlElement in doc.SelectNodes(xpath) )
{
Console.WriteLine( "{0} of type {1}",
Name, GetAttribute("Type") );
}

2 Comments:

At 11/17/2005 10:54 PM, Blogger job opportunitya said...

Exciting blog. The site out did itself and will be
back! I love surfing the internet for blogs that are
exactly like this blog.
Please go over my plastic surgery michigan blog.

 
At 12/10/2005 10:01 AM, Blogger job opportunitya said...

Sensational blog. I took pleasure in the site and I
will go back! Surfing online for blogs like this one
is worth my time.
I know that you love my work so, look up my bad celebrity plastic surgery blog.

 

Post a Comment

<< Home