Get IEnumerable element without use FOR EACH

Hello friends…

I have a specific situation where I need to get the value of an element from an IEnumerable object but without using for each.

I used this command “NumeroDaNota.ElementAtOrDefault(0).Value” but the result was this ==> “Número00001234”

When I use For Each and show the currentItem content it only shows me “00001234”

Is there any way to get the content of the element without using For Each …?

Grateful

@egameiro

You can directly use like this

Numerodanota.Select(function(x) x.Value)(0)

Cheers

Hi,

Which type is NumeroDaNota such as IEnumeable<XElement> etc?

Regards,

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.