У меня есть XML, например
Код: Выделить всё
jpg
jpeg
tif
tiff
gif
png
Во-первых, я впервые использую структуру со списком одинаковых имен элементов FileExtension.
И, похоже, она так и не нашла ее.
p>
Я основываю это на предыдущем тестовом коде, где с помощью XML типа...
Код: Выделить всё
someguy
some other last name again
12345634543
some other town
some other state
Код: Выделить всё
IEnumerable someClients =
from el in doc.Elements("Customers").Elements("Client")
where (string)el.Element("PhoneNumber") == phoneNumberToFind
select el;
Код: Выделить всё
Console.WriteLine("Found client named '{0}'", (string)el.Element("LastName").Value );
Код: Выделить всё
someguy
some other last name again
12345634543
some other town
some other state
Код: Выделить всё
An unhandled exception of type 'System.NullReferenceException' occurred in ......dll: 'Object reference not set to an instance of an object.'
Код: Выделить всё
string fTestAttr1= (string)el.Element("Client").Value;
string fTestAttr2= (string)el.Element("Client").Attribute("TestAttr");
string fTestAttr3= (string)el.Element("Client").Attribute("TestAttr").Value;
string fTestAttr4= (string)el.Element("Client").FirstAttribute.Value;
string fTestAttr4= (string)el.Element("Client").FirstAttribute.Value)
Спасибо за любую поддержку
JC
Подробнее здесь: https://stackoverflow.com/questions/786 ... in-c-sharp