Class GorgonNamedObjectList<T>
A list to contain IGorgonNamedObject types.
Inherited Members
Namespace: Gorgon.Collections.Specialized
Assembly: Gorgon.Core.dll
Syntax
public class GorgonNamedObjectList<T> : 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 list. Must implement the IGorgonNamedObject interface. |
Remarks
This is a concrete implementation of the GorgonBaseNamedObjectList<T> type.
This collection is not thread safe.
Constructors
| Edit this page View SourceGorgonNamedObjectList(bool)
Initializes a new instance of the GorgonNamedObjectList<T> class.
Declaration
public GorgonNamedObjectList(bool caseSensitive = true)
Parameters
Type | Name | Description |
---|---|---|
bool | caseSensitive | [Optional] true to use case sensitive keys, false to ignore casing. |
Properties
| Edit this page View Sourcethis[int]
Property to set or return an item in this list by index.
Declaration
public T this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
int | index |
Property Value
Type | Description |
---|---|
T |
this[string]
Property to return an item in this list by name.
Declaration
public T this[string name] { get; }
Parameters
Type | Name | Description |
---|---|---|
string | name |
Property Value
Type | Description |
---|---|
T |
Methods
| Edit this page View SourceAdd(T)
Function to add an item to the list.
Declaration
public void Add(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | Item to add to the list. |
AddRange(IEnumerable<T>)
Function to add a list of items to this list.
Declaration
public void AddRange(IEnumerable<T> items)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | items | The items to add to this list. |
Clear()
Function to clear the items from the list.
Declaration
public void Clear()
Insert(int, T)
Function to insert an item in the list at the specified index.
Declaration
public void Insert(int index, T item)
Parameters
Type | Name | Description |
---|---|---|
int | index | Index to insert at. |
T | item | Item to insert. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown when the |
InsertRange(int, IEnumerable<T>)
Function to insert a list of items at the specified index.
Declaration
public void InsertRange(int index, IEnumerable<T> items)
Parameters
Type | Name | Description |
---|---|---|
int | index | Index to insert at. |
IEnumerable<T> | items | The list of items to insert. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown when the |
Remove(int)
Function to remove an item at the specified index.
Declaration
public void Remove(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | Index of the item to remove. |
Remove(string)
Function to remove an item with the specified name from this list.
Declaration
public void Remove(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | Name of the item to remove. |
Exceptions
Type | Condition |
---|---|
KeyNotFoundException | Thrown when no item with the specified |
Remove(T)
Function to remove an item from this list.
Declaration
public void Remove(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | Item to remove from the list. |