How to loop through all XElement attributes and get their values?
foreach (SyndicationElementExtension extension in f.ElementExtensions)
{
XElement element = extension.GetObject<XElement>();
// How to loop through all its attributes and get their values?
}
Thank you!
Simple - use the Attributes()
method:
foreach (var attribute in element.Attributes())
{
string value = attribute.Value;
// ...
}
Assuming you want an answer to this question
var img2 = feeds.Items
.SelectMany(i => i.ElementExtensions
.Select(e => e.GetObject<XElement>().Attribute("url").Value)
)
.ToArray();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With