Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetDescendants< T >()

static IEnumerable< XElement > System.Xml.Linq.Extensions.GetDescendants< T > ( IEnumerable< T > source,
XName name,
bool self )
inlinestaticprivate
Type Constraints
T :XContainer 

Definition at line 321 of file Extensions.cs.

321 : XContainer
322 {
323 foreach (T root in source)
324 {
325 if (root == null)
326 {
327 continue;
328 }
329 if (self)
330 {
331 XElement xElement = (XElement)(object)root;
332 if (name == null || xElement.name == name)
333 {
334 yield return xElement;
335 }
336 }
337 XNode i = root;
338 XContainer xContainer = root;
339 while (true)
340 {
341 if (xContainer != null && xContainer.content is XNode)
342 {
343 i = ((XNode)xContainer.content).next;
344 }
345 else
346 {
347 while (i != null && i != root && i == i.parent.content)
348 {
349 i = i.parent;
350 }
351 if (i == null || i == root)
352 {
353 break;
354 }
355 i = i.next;
356 }
357 XElement e = i as XElement;
358 if (e != null && (name == null || e.name == name))
359 {
360 yield return e;
361 }
362 xContainer = e;
363 }
364 }
365 }

References System.Xml.Dictionary, System.Xml.Linq.XElement.name, and System.source.