Table of Contents

Class AstNodeCollection<T>

Namespace
ICSharpCode.Decompiler.CSharp.Syntax
Assembly
ICSharpCode.Decompiler.dll

Represents the children of an AstNode that have a specific role.

public class AstNodeCollection<T> : ICollection<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable where T : AstNode

Type Parameters

T
Inheritance
AstNodeCollection<T>
Implements
Inherited Members

Constructors

AstNodeCollection(AstNode, Role<T>)

public AstNodeCollection(AstNode node, Role<T> role)

Parameters

node AstNode
role Role<T>

Properties

Count

public int Count { get; }

Property Value

int

Methods

AcceptVisitor(IAstVisitor)

Applies the visitor to all nodes in this collection.

public void AcceptVisitor(IAstVisitor visitor)

Parameters

visitor IAstVisitor

Add(T)

public void Add(T element)

Parameters

element T

AddRange(IEnumerable<T>)

public void AddRange(IEnumerable<T> nodes)

Parameters

nodes IEnumerable<T>

AddRange(T[])

public void AddRange(T[] nodes)

Parameters

nodes T[]

Clear()

public void Clear()

Contains(T)

public bool Contains(T element)

Parameters

element T

Returns

bool

CopyTo(T[], int)

public void CopyTo(T[] array, int arrayIndex)

Parameters

array T[]
arrayIndex int

Detach()

public IEnumerable<T> Detach()

Returns

IEnumerable<T>

Equals(object)

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

FirstOrNullObject(Func<T, bool>)

Returns the first element for which the predicate returns true, or the null node (AstNode with IsNull=true) if no such object is found.

public T FirstOrNullObject(Func<T, bool> predicate = null)

Parameters

predicate Func<T, bool>

Returns

T

GetEnumerator()

public IEnumerator<T> GetEnumerator()

Returns

IEnumerator<T>

GetHashCode()

public override int GetHashCode()

Returns

int

InsertAfter(T, T)

public void InsertAfter(T existingItem, T newItem)

Parameters

existingItem T
newItem T

InsertBefore(T, T)

public void InsertBefore(T existingItem, T newItem)

Parameters

existingItem T
newItem T

LastOrNullObject(Func<T, bool>)

Returns the last element for which the predicate returns true, or the null node (AstNode with IsNull=true) if no such object is found.

public T LastOrNullObject(Func<T, bool> predicate = null)

Parameters

predicate Func<T, bool>

Returns

T

MoveTo(ICollection<T>)

public void MoveTo(ICollection<T> targetCollection)

Parameters

targetCollection ICollection<T>

Remove(T)

public bool Remove(T element)

Parameters

element T

Returns

bool

ReplaceWith(IEnumerable<T>)

public void ReplaceWith(IEnumerable<T> nodes)

Parameters

nodes IEnumerable<T>