Click or drag to resize

ExtensionMethodsAddNoDuplicatesT Method (ListT, T)

Add only unique items to a list.

Namespace:  DustProductions.Core
Assembly:  DustProductions.Core (in DustProductions.Core.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
public static bool AddNoDuplicates<T>(
	this List<T> list,
	T obj
)

Parameters

list
Type: System.Collections.GenericListT
The list
obj
Type: T
The object to add

Type Parameters

T
The type of the list's objects

Return Value

Type: Boolean
True if object is successfully added, false if it is already in the list

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ListT. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also