CodeObjectCollection<T> Class

Represents a collection of code objects that automatically manages parent-child relationships.

public class CodeObjectCollection<T> : CodeObject, ICollection<T>, IEnumerable<T>, IList<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, IEnumerable where T : CodeObject

Type parameters

T
The type of code objects in the collection.
Inheritance
CodeObject CodeObjectCollection<T>
Implements

Constructors

NameDescription
CodeObjectCollection()
CodeObjectCollection(CodeObject)Initializes a new instance of the CodeObjectCollection<T> class with the specified parent.

CodeObjectCollection overloads

CodeObjectCollection()

CodeObjectCollection.cs
public CodeObjectCollection()

No documentation is available.

CodeObjectCollection(CodeObject)

CodeObjectCollection.cs

Initializes a new instance of the CodeObjectCollection<T> class with the specified parent.

public CodeObjectCollection(CodeObject parent)
Parameters
parent CodeObject
The parent code object.

Properties

NameDescription
CountGets the number of items in the collection.
IsReadOnlyGets a value indicating whether the collection is read-only.

Gets the number of items in the collection.

public int Count { get; }

Property value

int

Gets a value indicating whether the collection is read-only.

public bool IsReadOnly { get; }

Property value

bool

Indexers

NameDescription
this[int]Gets or sets the item at the specified index.

Gets or sets the item at the specified index.

public T this[int index] { get; set; }

Parameters

index int
The zero-based index of the item.

Property value

T

Methods

NameDescription
Add<TCodeObject>(TCodeObject)Adds an item to the collection and returns it.
AddRange(IEnumerable<T>)Adds a range of items to the collection.
Clear()
Contains(T)
CopyTo(T[], int)
GetEnumerator()
IndexOf(T)
Insert(int, T)
Remove(T)
RemoveAt(int)
Sort(IComparer<T>)Sorts the elements in the collection using the specified comparer.
System.Collections.Generic.ICollection<T>.Add(T)
System.Collections.IEnumerable.GetEnumerator()

Add<TCodeObject>(TCodeObject)

CodeObjectCollection.cs

Adds an item to the collection and returns it.

public TCodeObject Add<TCodeObject>(TCodeObject item) where TCodeObject : T

Type parameters

TCodeObject
The type of the code object to add.

Parameters

item TCodeObject
The item to add.

Returns

TCodeObject The added item.

AddRange(IEnumerable<T>)

CodeObjectCollection.cs

Adds a range of items to the collection.

public void AddRange(IEnumerable<T> items)

Parameters

items IEnumerable<T>
The items to add.
public void Clear()

No documentation is available.

public bool Contains(T item)

Parameters

item T

Returns

bool

No documentation is available.

CopyTo(T[], int)

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

Parameters

array T[]
arrayIndex int

No documentation is available.

public IEnumerator<T> GetEnumerator()

No documentation is available.

public int IndexOf(T item)

Parameters

item T

Returns

int

No documentation is available.

public void Insert(int index, T item)

Parameters

index int
item T

No documentation is available.

public bool Remove(T item)

Parameters

item T

Returns

bool

No documentation is available.

public void RemoveAt(int index)

Parameters

index int

No documentation is available.

Sort(IComparer<T>)

CodeObjectCollection.cs

Sorts the elements in the collection using the specified comparer.

public void Sort(IComparer<T> comparer)

Parameters

comparer IComparer<T>
The comparer to use for sorting.

System.Collections.Generic.ICollection<T>.Add(T)

CodeObjectCollection.cs
void ICollection<T>.Add(T item)

Parameters

item T

No documentation is available.

System.Collections.IEnumerable.GetEnumerator()

CodeObjectCollection.cs
IEnumerator IEnumerable.GetEnumerator()

No documentation is available.