Class
WeakReferenceList<T>

Wraps instances of type T in WeakReference and stores them in a List.

Definition

Namespace:Telerik.Core

Assembly:Telerik.WinUI.Controls.dll

Type Parameters:

T

Syntax:

cs-api-definition
public class WeakReferenceList<T> : IEnumerable<T>, IEnumerable where T : class

Inheritance: objectWeakReferenceList<T>

Implements: IEnumerableIEnumerable<T>

Constructors

WeakReferenceList()

Initializes a new instance of the WeakReferenceList<T> class.

Declaration

cs-api-definition
public WeakReferenceList()

WeakReferenceList(bool)

Initializes a new instance of the WeakReferenceList<T> class.

Declaration

cs-api-definition
public WeakReferenceList(bool cleanNonAlive)

Parameters

cleanNonAlive

bool

True to remove any non-alive instances automatically, false otherwise.

WeakReferenceList(bool, bool)

Initializes a new instance of the WeakReferenceList<T> class.

Declaration

cs-api-definition
public WeakReferenceList(bool cleanNonAlive, bool trackResurrection)

Parameters

cleanNonAlive

bool

True to remove any non-alive instances automatically, false otherwise.

trackResurrection

bool

True to track object resurrection, false otherwise.

Properties

AutoCleanNonAlive

Gets or sets a value indicating whether the list will automatically remove any contained non-alive weak reference.

Declaration

cs-api-definition
public bool AutoCleanNonAlive { get; set; }

Property Value

bool

Count

Gets the count of the list.

Declaration

cs-api-definition
public int Count { get; }

Property Value

int

List

Gets the internal List used to store all instances.

Declaration

cs-api-definition
protected List<WeakReference<T>> List { get; }

Property Value

List<WeakReference<T>>

TrackResurrection

Gets or sets a value indicating whether resurrection for all added instances should be tracked.

Declaration

cs-api-definition
public bool TrackResurrection { get; set; }

Property Value

bool

this[int]

Gets or sets the item at the specified index.

Declaration

cs-api-definition
public T this[int index] { get; set; }

Parameters

index

int

Property Value

T

Methods

Add(T)

Adds the specified value.

Declaration

cs-api-definition
public void Add(T value)

Parameters

value

T

The value.

CleanNonAlive()

Cleans all targets that are no longer alive.

Declaration

cs-api-definition
public void CleanNonAlive()

Clear()

Clears the list.

Declaration

cs-api-definition
public void Clear()

Contains(T)

Gets a value indicating whether the item is present in the list.

Declaration

cs-api-definition
public bool Contains(T item)

Parameters

item

T

Returns

bool

GetEnumerator()

Gets the enumerator that iterates through all items.

Declaration

cs-api-definition
public IEnumerator<T> GetEnumerator()

Returns

IEnumerator<T>

Implements IEnumerable<T>.GetEnumerator()

IndexOf(T)

Gets the index of the specified value within the list.

Declaration

cs-api-definition
public int IndexOf(T value)

Parameters

value

T

The value to check for.

Returns

int

The index of the item.

Insert(int, T)

Inserts an item at the specified index.

Declaration

cs-api-definition
public void Insert(int index, T value)

Parameters

index

int

The index.

value

T

The value.

InsertCore(int, T)

Core insert implementation. Allows inheritors to provide their own implementation.

Declaration

cs-api-definition
protected virtual void InsertCore(int index, T value)

Parameters

index

int

The index.

value

T

The value.

Remove(T)

Removes the specified value.

Declaration

cs-api-definition
public void Remove(T value)

Parameters

value

T

The value.

RemoveAt(int)

Removes the value at the specified index.

Declaration

cs-api-definition
public void RemoveAt(int index)

Parameters

index

int

The index.