Table of Contents

Class RefreshingList<T>

Namespace
SunamoCollectionsGeneric.Collections.OverrideAddOrImpIList
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

T

The type of elements in the list

Inheritance
RefreshingList<T>
Implements
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

sourceToRefresh List<T>

The source list to refresh from when empty

items IList<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

sourceToRefresh List<T>

The source list to refresh from when empty

count int

The initial capacity

Properties

Count

Gets the number of elements contained in the list

public int Count { get; }

Property Value

int

IsReadOnly

Gets a value indicating whether the list is read-only

public bool IsReadOnly { get; }

Property Value

bool

this[int]

Gets or sets the element at the specified index

public T this[int index] { get; set; }

Parameters

index int

The 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

value T

The 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

value T

The 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

array T[]

The destination array

arrayIndex int

The 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

value T

The 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

index int

The zero-based index at which value should be inserted

value T

The value to insert

Remove(T)

Removes the first occurrence of a specific value from the list

public bool Remove(T value)

Parameters

value T

The 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

index int

The zero-based index of the item to remove

Sort()

Sorts the elements in the entire list

public void Sort()