Attributes

The Attributes operator can be called on a sequence of elements and returns a sequence containing the attributes of each source element.

Prototypes

The Attributes operator has two prototypes.

Example. The First Attributes Prototype
public static IEnumerable<XAttribute> Attributes (
  this IEnumerable<XElement> source
)

This version of the operator can be called on a sequence of elements and returns a sequence of attributes containing all the attributes for each source element.

Example. The Second Attributes Prototype
public static IEnumerable<XAttribute> Attributes (
  this IEnumerable<XElement> source,
  XName name
)

This version of the operator is like the first, except only those attributes matching the specified name will be returned ...

Get Pro LINQ: Language Integrated Query in C# 2008 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.