Key.

Key.KeyedList<T> Class

Summary

A System.Collections.Generic.List`1 which can remove items without needing to search the entire collection.
Assembly
Animancer.dll
Namespace
Animancer
Interfaces
  • IList<T>
  • ICollection
Base Types
  • Object
graph BT Type-->Base0["Object"] Type-.->Interface0["IList<T>"] Type-.->Interface1["ICollection"] Type["Key.KeyedList<T>"] class Type type-node

Syntax

public class Key.KeyedList<T> : IList<T>, ICollection where T : class, Key.IListItem

Remarks

This implementation has several restrictions compared to a regular System.Collections.Generic.List`1:
  • Items must implement or inherit from .
  • Items cannot be null.
  • Items can only be in one at a time and cannot appear multiple times in it.
This class is nested inside Animancer.Key so it can modify the private Animancer.Key._Index without exposing that capability to anything else.

Type Parameters

Name Description
T

Constructors

Name Summary
KeyedList() Creates a new Animancer.Key.KeyedList`1 using the default System.Collections.Generic.List`1 constructor.
KeyedList(int) Creates a new Animancer.Key.KeyedList`1 with the specified initial `capacity`.

Properties

Name Value Summary
Capacity int
The number of items that this list can contain before resizing is required.
Count int
The number of items currently in the list.
this[int] T
The item at the specified `index`.

Methods

Name Value Summary
Add(T) void
Adds the `item` to the end of this list.
AddNew(T) void
Adds the `item` to the end of this list if it wasn't already in it.
Clear() void
Removes all items from this list.
Contains(T) bool
Indicates whether the `item` is currently in this list.
CopyTo(T[], int) void
Copies all the items from this list into the `array`, starting at the specified `index`.
GetEnumerator() List<T>.Enumerator
Returns an enumerator that iterates through this list.
IndexOf(T) int
Returns the index of the `item` in this list or -1 if it is not in this list.
Insert(int, T) void
Adds the `item` to this list at the specified `index`.
Remove(T) bool
Removes the `item` from this list.
RemoveAt(int) void
Removes the item at the specified `index`.
RemoveAtSwap(int) void
Removes the item at the specified `index` by swapping the last item in this list into its place.
RemoveSwap(T) bool
Removes the `item` by swapping the last item in this list into its place.