Class RefreshingList<T>
- Assembly
- SunamoCollectionsGeneric.dll
A list that automatically refreshes from a source list when it becomes empty
public class RefreshingList<T> : IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable
Type Parameters
TThe type of elements in the list
- Inheritance
-
RefreshingList<T>
- Implements
-
IList<T>ICollection<T>IEnumerable<T>
- Derived
- Inherited Members
- Extension Methods
Constructors
RefreshingList(List<T>, IList<T>)
Initializes a new instance with a source list and initial items
public RefreshingList(List<T> sourceToRefresh, IList<T> items)
Parameters
sourceToRefreshList<T>The source list to refresh from when empty
itemsIList<T>The initial items to populate the list
RefreshingList(List<T>, int)
Initializes a new instance with a source list and initial capacity
public RefreshingList(List<T> sourceToRefresh, int count)
Parameters
Properties
Count
Gets the number of elements contained in the list
public int Count { get; }
Property Value
IsReadOnly
Gets a value indicating whether the list is read-only
public bool IsReadOnly { get; }
Property Value
this[int]
Gets or sets the element at the specified index
public T this[int index] { get; set; }
Parameters
indexintThe zero-based index of the element
Property Value
- T
The element at the specified index
Methods
Add(T)
Adds a value to the list
public void Add(T value)
Parameters
valueTThe value to add
Clear()
Removes all values from the list
public void Clear()
Contains(T)
Determines whether the list contains a specific value
public bool Contains(T value)
Parameters
valueTThe value to locate
Returns
- bool
True if value is found; otherwise, false
CopyTo(T[], int)
Copies the elements to an array, starting at a particular array index
public void CopyTo(T[] array, int arrayIndex)
Parameters
arrayT[]The destination array
arrayIndexintThe zero-based index at which copying begins
GetEnumerator()
Returns an enumerator that iterates through the list
public IEnumerator<T> GetEnumerator()
Returns
- IEnumerator<T>
An enumerator for the list
IndexOf(T)
Determines the index of a specific value in the list
public int IndexOf(T value)
Parameters
valueTThe value to locate
Returns
- int
The index of value if found; otherwise, -1
Insert(int, T)
Inserts a value at the specified index
public void Insert(int index, T value)
Parameters
indexintThe zero-based index at which value should be inserted
valueTThe value to insert
Remove(T)
Removes the first occurrence of a specific value from the list
public bool Remove(T value)
Parameters
valueTThe value to remove
Returns
- bool
True if value was successfully removed; otherwise, false
RemoveAt(int)
Removes the item at the specified index
public void RemoveAt(int index)
Parameters
indexintThe zero-based index of the item to remove
Sort()
Sorts the elements in the entire list
public void Sort()