Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
LinkedList(T) Constructor (IEnumerable(T))

LinkedList(T) Constructor (IEnumerable(T))

Initializes a new instance of the LinkedList(T) class that contains elements copied from the specified IEnumerable and has sufficient capacity to accommodate the number of elements copied.

Namespace:  System.Collections.Generic
Assemblies:   System.Collections (in System.Collections.dll)
  System (in System.dll)

new : 
        collection:IEnumerable<'T> -> LinkedList

Parameters

collection
Type: System.Collections.Generic.IEnumerable(T)

The IEnumerable whose elements are copied to the new LinkedList(T).

ExceptionCondition
ArgumentNullException

collection is a null reference (Nothing in Visual Basic).

LinkedList(T) accepts a null reference (Nothing in Visual Basic) as a valid Value for reference types and allows duplicate values.

If collection has no elements then the new LinkedList(T) is empty, and the First and Last properties contain a null reference (Nothing in Visual Basic).

This constructor is an O(n) operation, where n is the number of elements in collection.

For an example that includes this constructor, see the LinkedList(T) class.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

XNA Framework

Supported in: 3.0, 2.0, 1.0

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8

Portable Class Library

Supported in: Portable Class Library
Show:
© 2015 Microsoft