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

◆ GetDescendantNodes< T >()

static IEnumerable< XNode > System.Xml.Linq.Extensions.GetDescendantNodes< T > ( IEnumerable< T > source,
bool self )
inlinestaticprivate
Type Constraints
T :XContainer 

Definition at line 284 of file Extensions.cs.

284 : XContainer
285 {
286 foreach (T root in source)
287 {
288 if (root == null)
289 {
290 continue;
291 }
292 if (self)
293 {
294 yield return root;
295 }
296 XNode i = root;
297 while (true)
298 {
299 XNode firstNode;
300 if (i is XContainer xContainer && (firstNode = xContainer.FirstNode) != null)
301 {
302 i = firstNode;
303 }
304 else
305 {
306 while (i != null && i != root && i == i.parent.content)
307 {
308 i = i.parent;
309 }
310 if (i == null || i == root)
311 {
312 break;
313 }
314 i = i.next;
315 }
316 yield return i;
317 }
318 }
319 }

References System.Xml.Dictionary, and System.source.