Class GorgonBaseNamedObjectList<T>
Base list type for Gorgon library named objects.
Inherited Members
Namespace: Gorgon.Collections
Assembly: Gorgon.Core.dll
Syntax
public abstract class GorgonBaseNamedObjectList<T> : IGorgonNamedObjectList<T>, IList<T>, ICollection<T>, IGorgonNamedObjectReadOnlyList<T>, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable where T : IGorgonNamedObject
Type Parameters
Name | Description |
---|---|
T | The type of object to store in the collection. Must implement the IGorgonNamedObject interface. |
Remarks
This is a base class used to help in the creation of custom lists that store objects that implement the IGorgonNamedObject interface.
Constructors
| Edit this page View SourceGorgonBaseNamedObjectList(bool)
Initializes a new instance of the GorgonBaseNamedObjectList<T> class.
Declaration
protected GorgonBaseNamedObjectList(bool caseSensitive)
Parameters
Type | Name | Description |
---|---|---|
bool | caseSensitive | true to use case sensitive keys, false to ignore casing. |
Properties
| Edit this page View SourceCount
Gets the number of elements contained in the list.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
int |
Items
Property to return the list of items in the underlying collection.
Declaration
protected IList<T> Items { get; }
Property Value
Type | Description |
---|---|
IList<T> |
KeysAreCaseSensitive
Property to return whether the keys are case sensitive.
Declaration
public bool KeysAreCaseSensitive { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
| Edit this page View SourceAddItems(IEnumerable<T>)
Function to add items to the list.
Declaration
protected void AddItems(IEnumerable<T> items)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | items | List of items to add. |
Contains(string)
Function to return whether an item with the specified name exists in this collection.
Declaration
public bool Contains(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | Name of the item to find. |
Returns
Type | Description |
---|---|
bool | true if found, false if not. |
Contains(T)
Determines whether the list contains a specific value.
Declaration
public bool Contains(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The object to locate in the list. |
Returns
Type | Description |
---|---|
bool | true if |
CopyTo(T[], int)
Declaration
public void CopyTo(T[] array, int arrayIndex)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | The one-dimensional Array that is the destination of the elements copied from list. The Array must have zero-based indexing. |
int | arrayIndex | The zero-based index in |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ArgumentOutOfRangeException |
|
ArgumentException |
-or-
|
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<T> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<T> | A IEnumerator<T> that can be used to iterate through the collection. |
GetItemByName(string)
Function to retrieve the item at the specified index by name.
Declaration
protected T GetItemByName(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | Name of the object to find. |
Returns
Type | Description |
---|---|
T | The object with the specified name. |
Exceptions
Type | Condition |
---|---|
KeyNotFoundException | Thrown when no object with the specified |
IndexOf(string)
Determines the index of a specific item in the list.
Declaration
public int IndexOf(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | Name of the item to find. |
Returns
Type | Description |
---|---|
int | The index of |
IndexOf(T)
Determines the index of a specific item in the list.
Declaration
public int IndexOf(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The object to locate in the list. |
Returns
Type | Description |
---|---|
int | The index of |
InsertItems(int, IEnumerable<T>)
Function to insert items into the list at a given index.
Declaration
protected void InsertItems(int index, IEnumerable<T> items)
Parameters
Type | Name | Description |
---|---|---|
int | index | Index to insert at. |
IEnumerable<T> | items | Items to add. |
RemoveItemByName(string)
Function to remove an item from the list by its name.
Declaration
protected void RemoveItemByName(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | Name of the item to remove. |