Class RuntimeList<T>
An abstract generic RuntimeObject which encapsulates the List class. Inherit from this class to create your own RuntimeList sub class. Give your class the CreateAssetMenu attribute to serialize an instance of it.
Namespace: ScriptableFramework
Assembly: cs.temp.dll.dll
Syntax
public abstract class RuntimeList<T> : RuntimeObject, IList<T>
Type Parameters
| Name | Description |
|---|---|
| T | The type that will be stored in this object's internal
generic |
Fields
items
A list of the elements in this object to be accessed externally via square bracket operator.
Declaration
protected List<T> items
Field Value
| Type | Description |
|---|---|
| List<T> |
Properties
Count
Returns the number of elements currently in the list.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
IsReadOnly
Will always return false.
Declaration
public bool IsReadOnly { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Item[Int32]
Declaration
public T this[int index] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index |
Property Value
| Type | Description |
|---|---|
| T |
Methods
Add(T)
Append an object to the end of this list.
Declaration
public virtual void Add(T item)
Parameters
| Type | Name | Description |
|---|---|---|
| T | item | The object to be added as an element. |
AddRange(IEnumerable<T>)
Append objects to the end of this list.
Declaration
public virtual void AddRange(IEnumerable<T> items)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<T> | items | A collection of objects to be appended to this list. |
Clear()
Empty this list of all elements.
Declaration
public override void Clear()
Overrides
Contains(T)
Declaration
public virtual bool Contains(T item)
Parameters
| Type | Name | Description |
|---|---|---|
| T | item |
Returns
| Type | Description |
|---|---|
| System.Boolean |
CopyTo(T[], Int32)
Declaration
public virtual void CopyTo(T[] array, int arrayIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| T[] | array | |
| System.Int32 | arrayIndex |
GetEnumerator()
Declaration
public IEnumerator<T> GetEnumerator()
Returns
| Type | Description |
|---|---|
| IEnumerator<T> |
GetItem(Int32)
Read an element at a given index from this list. Called when the list is read from via square brackets.
Declaration
protected virtual T GetItem(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index | The index of the element to be returned. |
Returns
| Type | Description |
|---|---|
| T | The element object at the given index. |
IndexOf(T)
Get the index of a given item if it exists as an element in this list.
Declaration
public virtual int IndexOf(T item)
Parameters
| Type | Name | Description |
|---|---|---|
| T | item |
Returns
| Type | Description |
|---|---|
| System.Int32 |
Initialise(IEnumerable<T>)
Shorthand for calling Clear () and then AddRange (items).
Declaration
public virtual void Initialise(IEnumerable<T> items)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<T> | items | A collection of objects to be appended to this list. |
Initialise(Int32)
Shorthand for calling Clear () and then adding a number of empty/null objects.
Declaration
public abstract void Initialise(int newCount)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | newCount | The number of empty/null objects to add. |
Insert(Int32, T)
Declaration
public virtual void Insert(int index, T item)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index | |
| T | item |
Remove(T)
If the item exists as an element in this list, remove it and shift the index of the elements after it down by one.
Declaration
public virtual void Remove(T item)
Parameters
| Type | Name | Description |
|---|---|---|
| T | item | The element to remove. |
RemoveAt(Int32)
Declaration
public virtual void RemoveAt(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index |
Reset()
Calls Clear ().
Declaration
public override void Reset()
Overrides
SetItem(Int32, T)
Pass an object back into the list and raise an event if an event was set in the inspector. Called when the list is written to via square brackets.
Declaration
protected virtual void SetItem(int index, T newItem)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index | The index of the element being written to. |
| T | newItem | The new value to set in place of the previous value in the given index. |
ToArray()
Declaration
public virtual T[] ToArray()
Returns
| Type | Description |
|---|---|
| T[] |
ToList()
Declaration
public virtual List<T> ToList()
Returns
| Type | Description |
|---|---|
| List<T> |