0

如何通过参数传递我的变量Iterator

protected void LeXMLNode(FileUpload fupArquivo)
        {
            XmlDocument doc = new XmlDocument();
            doc.Load(fupArquivo.FileContent);

            XmlNodeList ndo = doc.SelectNodes("*");

            var it = ndo.GetEnumerator();
            using (it as IDisposable)
            while (it.MoveNext())
            {                
                //// Pass the variable it as parameter
            }
        }
4

1 回答 1

1

使用.Current属性:

using (var it = ndo.GetEnumerator())
    while (it.MoveNext())
    {                
        //// Pass the variable it as parameter
        SomeFunction(it.Current);
    }
于 2012-08-06T19:47:58.933 回答