Wednesday, November 25, 2009

exit for in C#

If you wanna use something similar with “exit for”  in Visual Basic, in C# you can just use break.

 

For example:

                        foreach (XmlNode xmlChild in xmlDestNodes.ChildNodes)

                        {

                              if (sDestCode == xmlChild.Attributes["code"].InnerText)

                              {

                                    sDestination = xmlChild.InnerText;

                                    break;

                              }

                        }

 

So easy, isn’t it?

No comments:

Post a Comment