Remove

The Remove operator can be called on a sequence of nodes or attributes to remove them. This method will cache a copy of the nodes or attributes in a List to eliminate the Halloween problem discussed in the previous chapter.

Prototypes

The Remove operator has two prototypes.

Example. The First Remove Prototype
public static void Remove (
  this IEnumerable<XAttribute> source
)

This version is called on a sequence of attributes and removes all attributes in the source sequence.

Example. The Second Remove Prototype
public static void Remove<T> (
  this IEnumerable<T> source
) where T : XNode

This version is called on a sequence of a specified type, which must be nodes or some type derived from nodes, and removes all nodes in the source sequence. ...

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.