Код: Выделить всё
using System;
using System.Threading.Tasks;
using System.Xml;
namespace cabinet;
public class Program
{
public static void Main(string[] args)
{
XmlNodeList nodeList = XMLUtils.GetXPathNodes("./data/xml/cabinet.xml", "//cab:numéro");
foreach (XmlNode node in nodeList)
{
Console.WriteLine(node.InnerText);
}
}
}
Это не работает:
Код: Выделить всё
foreach (var node in nodeList)
{
Console.WriteLine(node.InnerText);
}
Код: Выделить всё
'object' does not contain a definition for 'InnerText' and no accessible extension method 'InnerText' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
Пожалуйста, исправьте, если я ошибаюсь насчет объекта, и объясните, почему я помещаю var здесь не работает.
Подробнее здесь: https://stackoverflow.com/questions/792 ... s-expected
Мобильная версия