[Solved] New version of doing a for loop?
[ad_1] I don’t think this loop is a good candidate for a foreach loop. If you were to do so, it would look something like this: var codeLengths = new[] { 4, 3, 2, 1 }; foreach (length in codeLengths) { if(xmlGenioCodes.SelectSingleNode(String.Format(“GenioCodes[Code =\”{0}\”]”, strCodeMX.Substring(0, length))) != null) { strCodeMXLayer = strCodeMX.Substring(0, length); break; } } … Read more