Class CollectionWrapper<T>
Represents an abstract collection of items. The items are stored internally as List. Implement your own concrete collections by inheriting from this class.
Inherited Members
Namespace: Unity.Tutorials.Core.Editor
Assembly: Unity.Tutorials.Core.Editor.dll
Syntax
public abstract class CollectionWrapper<T> : CollectionWrapper, IEnumerable<T>, IEnumerable
Type Parameters
Name | Description |
---|---|
T | The type of elements in the collection. |
Constructors
CollectionWrapper()
Default-constructs an empty collection.
Declaration
public CollectionWrapper()
CollectionWrapper(IList<T>)
Constructs with items.
Declaration
public CollectionWrapper(IList<T> items)
Parameters
Type | Name | Description |
---|---|---|
IList<T> | items | The List of item this CollectionWrapper will initially contain |
Properties
Count
The count of items.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
int |
this[int]
Set or get the item at index i
Declaration
public T this[int i] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
int | i | The index of the requested item |
Property Value
Type | Description |
---|---|
T |
Methods
AddItem(T)
Adds an item to the collection
Declaration
public void AddItem(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The item to add to the Collection |
GetEnumerator()
Returns an Enumerator to the items.
Declaration
public IEnumerator<T> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<T> | An IEnumerator on the items array |
GetItems(List<T>)
Returns the items of the collection as a list.
Declaration
public void GetItems(List<T> items)
Parameters
Type | Name | Description |
---|---|---|
List<T> | items | The List to which the containing items will be added to. This List is cleared before insertion! |
SetItems(IEnumerable<T>)
Sets the items of the collection.
Declaration
public void SetItems(IEnumerable<T> items)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | items | The List that contained the item that will be added to this Collection. The Collection is cleared before insertion! |