MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
GenericList.cs
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using System.Linq;
5using System.Text;
6using System.Threading.Tasks;
7
8namespace MyCaffe.basecode
9{
14 public class GenericList<T> : IEnumerable<T>
15 {
19 protected List<T> m_rgItems = new List<T>();
20
24 public GenericList()
25 {
26 }
27
31 public int Count
32 {
33 get { return m_rgItems.Count; }
34 }
35
40 public virtual void Add(T item)
41 {
42 m_rgItems.Add(item);
43 }
44
50 public bool Remove(T item)
51 {
52 return m_rgItems.Remove(item);
53 }
54
59 public void RemoveAt(int nIdx)
60 {
61 m_rgItems.RemoveAt(nIdx);
62 }
63
67 public void Clear()
68 {
69 m_rgItems.Clear();
70 }
71
76 public IEnumerator<T> GetEnumerator()
77 {
78 return m_rgItems.GetEnumerator();
79 }
80
85 IEnumerator IEnumerable.GetEnumerator()
86 {
87 return m_rgItems.GetEnumerator();
88 }
89
95 public T this[int nIdx]
96 {
97 get { return m_rgItems[nIdx]; }
98 set { m_rgItems[nIdx] = value; }
99 }
100 }
101}
The GenericList provides a base used to implement a generic list by only implementing the minimum amo...
Definition: GenericList.cs:15
void RemoveAt(int nIdx)
Remove the item at a given index in the list.
Definition: GenericList.cs:59
List< T > m_rgItems
The actual list of items.
Definition: GenericList.cs:19
IEnumerator< T > GetEnumerator()
Get the list enumerator.
Definition: GenericList.cs:76
int Count
Returns the number of items in the list.
Definition: GenericList.cs:32
GenericList()
The constructor.
Definition: GenericList.cs:24
virtual void Add(T item)
Add a new item to the list.
Definition: GenericList.cs:40
void Clear()
Remove all items from the list.
Definition: GenericList.cs:67
bool Remove(T item)
Remove an item from the list.
Definition: GenericList.cs:50
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
Definition: Annotation.cs:12