Table of Contents

TryAdd Method

Definition

Namespace
Cuemon.Extensions.Collections.Generic
Assemblies
Cuemon.Extensions.Collections.Generic.dll
Source
src/Cuemon.Extensions.Collections.Generic/ListExtensions.cs

TryAdd<T>(IList<T>, T)

Attempts to add the specified item to the list.

public static bool TryAdd<T>(this IList<T> list, T item)

Parameters

list IList<T>

The IList<T> to extend.

item T

The item to add.

Returns

bool

true if the item was added to the list successfully, false otherwise.

Type Parameters

T

Remarks

This method will add the specified item to the list if it is not already present.