Class ComponentCollection<TComponent>
- Namespace
- Lime
- Assembly
- Lime.dll
public class ComponentCollection<TComponent> : ICollection<TComponent>, IEnumerable<TComponent>, IEnumerable where TComponent : Component
Type Parameters
TComponent
- Inheritance
-
ComponentCollection<TComponent>
- Implements
-
ICollection<TComponent>IEnumerable<TComponent>
- Derived
- Inherited Members
- Extension Methods
Properties
Count
Gets the number of elements contained in the ICollection<T>.
public int Count { get; }
Property Value
- int
The number of elements contained in the ICollection<T>.
IsReadOnly
Gets a value indicating whether the ICollection<T> is read-only.
public bool IsReadOnly { get; }
Property Value
- bool
true if the ICollection<T> is read-only; otherwise, false.
Methods
Add(TComponent)
Adds an item to the ICollection<T>.
public virtual void Add(TComponent component)
Parameters
component
TComponent
Exceptions
- NotSupportedException
The ICollection<T> is read-only.
CanAdd(Type)
public bool CanAdd(Type type)
Parameters
type
Type
Returns
CanAdd<T>()
public bool CanAdd<T>() where T : TComponent
Returns
Type Parameters
T
Clear()
Removes all items from the ICollection<T>.
public void Clear()
Exceptions
- NotSupportedException
The ICollection<T> is read-only.
Contains(Type)
public bool Contains(Type type)
Parameters
type
Type
Returns
Contains(TComponent)
Determines whether the ICollection<T> contains a specific value.
public virtual bool Contains(TComponent component)
Parameters
component
TComponent
Returns
- bool
true if
item
is found in the ICollection<T>; otherwise, false.
Contains<T>()
public bool Contains<T>()
Returns
Type Parameters
T
CopyTo(TComponent[], int)
Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.
public void CopyTo(TComponent[] array, int arrayIndex)
Parameters
array
TComponent[]The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing.
arrayIndex
intThe zero-based index in
array
at which copying begins.
Exceptions
- ArgumentNullException
array
is null.- ArgumentOutOfRangeException
arrayIndex
is less than 0.- ArgumentException
The number of elements in the source ICollection<T> is greater than the available space from
arrayIndex
to the end of the destinationarray
.
Get(Type)
public TComponent Get(Type type)
Parameters
type
Type
Returns
- TComponent
GetAll(Type)
public IEnumerable<TComponent> GetAll(Type type)
Parameters
type
Type
Returns
- IEnumerable<TComponent>
GetAll(Type, IList<TComponent>)
public void GetAll(Type type, IList<TComponent> result)
Parameters
GetAll<T>()
public IEnumerable<T> GetAll<T>()
Returns
- IEnumerable<T>
Type Parameters
T
GetAll<T>(IList<T>)
public void GetAll<T>(IList<T> result)
Parameters
result
IList<T>
Type Parameters
T
GetEnumerator()
public ComponentCollection<TComponent>.Enumerator GetEnumerator()
Returns
- ComponentCollection<TComponent>.Enumerator
GetOrAdd<T>()
public T GetOrAdd<T>() where T : TComponent, new()
Returns
- T
Type Parameters
T
Get<T>()
public T Get<T>()
Returns
- T
Type Parameters
T
OnRemove(TComponent)
protected virtual void OnRemove(TComponent component)
Parameters
component
TComponent
Remove(Type)
public bool Remove(Type type)
Parameters
type
Type
Returns
Remove(TComponent)
Removes the first occurrence of a specific object from the ICollection<T>.
public bool Remove(TComponent component)
Parameters
component
TComponent
Returns
- bool
true if
item
was successfully removed from the ICollection<T>; otherwise, false. This method also returns false ifitem
is not found in the original ICollection<T>.
Exceptions
- NotSupportedException
The ICollection<T> is read-only.
Remove<T>()
public bool Remove<T>()
Returns
Type Parameters
T
Replace<T>(T)
public bool Replace<T>(T component) where T : TComponent
Parameters
component
T
Returns
Type Parameters
T
TryGet<T>(out T)
public bool TryGet<T>(out T result)
Parameters
result
T
Returns
Type Parameters
T