Class GenericEnumerator<T>
- Namespace
- PolarStudio
- Assembly
- PolarStudio.dll
Class used for deriving enumerating classes from (mainly used for the repository)
public abstract class GenericEnumerator<T> : IEnumerable where T : class
Type Parameters
T
- Inheritance
-
GenericEnumerator<T>
- Implements
- Derived
- Inherited Members
- Extension Methods
Properties
Count
Returns the number of elements
public virtual int Count { get; }
Property Value
First
Returns the first element
public T First { get; }
Property Value
- T
this[object]
Gets an element. pIndex can be an Int for ItemByIndex or a string for ItemByName.
public T this[object pIndex] { get; }
Parameters
pIndex
objectIndex or name
Property Value
- T
The found element or Nothing
Last
Returns the last element
public T Last { get; }
Property Value
- T
ZeroBased
To set the behaviour of ItemByIndex to be ZeroBased or OneBased.
public bool ZeroBased { get; }
Property Value
Methods
ContainsKey(string)
This boolean indicates if the enumerator contains a certain Key (Name)
public bool ContainsKey(string pKey)
Parameters
pKey
stringThe Key (Name) to search for.
Returns
- bool
True if found.
Elements()
Returns an array containing all elements. Can be used to create a snapshot to enumerate if the underlying collection may change in the mean while.
public T[] Elements()
Returns
- T[]
GetEnumerator()
Returns the Enumerator to enumerate over the items.
public IEnumerator<T> GetEnumerator()
Returns
- IEnumerator<T>
IndexByAlternativeID(int)
Returns the Index of the given AlternativeID.
public int IndexByAlternativeID(int pAlternativeID)
Parameters
pAlternativeID
intThe AlternativeID to search for
Returns
- int
The zero-based index or -1 if not found.
IndexByID(int)
Returns the Index of the given ID.
public int IndexByID(int pID)
Parameters
pID
intThe ID to search for
Returns
- int
The zero-based index or -1 if not found.
IndexByName(string)
Returns the Index of the given name.
public int IndexByName(string pName)
Parameters
pName
stringThe name to search for
Returns
- int
The zero-based index or -1 if not found.
ItemByAlternativeID(int)
Returns an item by an alternative (secondary) ID
public T ItemByAlternativeID(int pAlternativeID)
Parameters
pAlternativeID
intThe alternative ID
Returns
- T
ItemByID(int)
Returns an item based on the ID of the item
public T ItemByID(int pID)
Parameters
pID
intThe ID that is searched for.
Returns
- T
ItemByName(string)
Returns an Item based on the name
public T ItemByName(string pName)
Parameters
pName
stringThe name that is searched for.
Returns
- T