LinkedList コンストラクタ (ジェネリック IEnumerable)
アセンブリ: System (system.dll 内)

Public Sub New ( _ collection As IEnumerable(Of T) _ )
Dim collection As IEnumerable(Of T) Dim instance As New LinkedList(Of T)(collection)
public LinkedList ( IEnumerable<T> collection )
public: LinkedList ( IEnumerable<T>^ collection )
public LinkedList ( IEnumerable<T> collection )
public function LinkedList ( collection : IEnumerable<T> )
- collection
新しい LinkedList に要素がコピーされた IEnumerable。

例外の種類 | 条件 |
---|---|
ArgumentNullException | collection が null 参照 (Visual Basic では Nothing) です。 |

LinkedList は、null 参照 (Visual Basic では Nothing) を参照型に対して有効な Value として受け取り、値の重複を許可します。
collection に要素がない場合、新しい LinkedList は空で、First プロパティと Last プロパティには null 参照 (Visual Basic では Nothing) が格納されます。

LinkedList(ジェネリック IEnumerable) コンストラクタのコード例および出力を次に示します。このコード例では、文字列の配列を作成し、その文字列の配列をコンストラクタに渡すことによって、LinkedList を作成し、データを読み込みます。
このコード例および出力は、LinkedList クラスのトピックで取り上げている例の一部分です。
Dim words() As String = _ { "the", "fox", "jumped", "over", "the", "dog" } Dim sentence As New LinkedList(Of String)(words) Display(sentence) Console.WriteLine("sentence.Contains(""jumped"") = {0}", _ sentence.Contains("jumped")) <br /><span space="preserve">...</span><br />'the fox jumped over the dog 'sentence.Contains("jumped") = True
string[] words = {"the", "fox", "jumped", "over", "the", "dog"}; LinkedList<string> sentence = new LinkedList<string>(words); Display(sentence); Console.WriteLine("sentence.Contains(\"jumped\") = {0}", sentence.Contains("jumped")); <br /><span space="preserve">...</span><br />//the fox jumped over the dog //sentence.Contains("jumped") = True
array<String^>^ words = {"the", "fox", "jumped", "over", "the", "dog"}; LinkedList<String^>^ sentence = gcnew LinkedList<String^>((IEnumerable<String^>^) words); Display(sentence); Console::WriteLine("sentence->Contains(\"jumped\") = {0}", sentence->Contains("jumped")); <br /><span space="preserve">...</span><br />//the fox jumped over the dog //sentence->Contains("jumped") = True

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


LinkedList コンストラクタ

名前 | 説明 |
---|---|
LinkedList () | LinkedList クラスの新しい空のインスタンスを初期化します。 .NET Compact Framework によってサポートされています。 |
LinkedList (ジェネリック IEnumerable) | 指定した IEnumerable からコピーした要素を格納し、コピーされる要素の数を格納できるだけの容量を備えた、LinkedList クラスの新しいインスタンスを初期化します。 .NET Compact Framework によってサポートされています。 |
LinkedList (SerializationInfo, StreamingContext) | 指定した SerializationInfo と StreamingContext を使用して、シリアル化可能な LinkedList クラスの新しいインスタンスを初期化します。 |

LinkedList コンストラクタ (SerializationInfo, StreamingContext)
アセンブリ: System (system.dll 内)

Dim info As SerializationInfo Dim context As StreamingContext Dim instance As New LinkedList(Of T)(info, context)
protected LinkedList ( SerializationInfo info, StreamingContext context )
protected: LinkedList ( SerializationInfo^ info, StreamingContext context )
protected LinkedList ( SerializationInfo info, StreamingContext context )

LinkedList は、null 参照 (Visual Basic では Nothing) を参照型に対して有効な Value として受け取り、値の重複を許可します。
LinkedList が空の場合、First プロパティと Last プロパティには null 参照 (Visual Basic では Nothing) が格納されます。

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


LinkedList コンストラクタ ()
アセンブリ: System (system.dll 内)

Dim instance As New LinkedList(Of T)

LinkedList は、null 参照 (Visual Basic では Nothing) を参照型に対して有効な Value として受け取り、値の重複を許可します。
LinkedList が空の場合、First プロパティと Last プロパティには null 参照 (Visual Basic では Nothing) が格納されます。

String 型の LinkedList を作成および初期化し、いくつかのノードを追加し、その内容を表示するコード例を次に示します。
Imports System Imports System.Collections Imports System.Collections.Generic Public Class GenericCollection Public Shared Sub Main() ' Create and initialize a new LinkedList. Dim ll As New LinkedList(Of String)() ll.AddLast("red") ll.AddLast("orange") ll.AddLast("yellow") ll.AddLast("orange") ' Display the contents of the LinkedList. If ll.Count > 0 Then Console.WriteLine("The first item in the list is {0}.", ll.First.Value) Console.WriteLine("The last item in the list is {0}.", ll.Last.Value) Console.WriteLine("The LinkedList contains:") For Each s As String In ll Console.WriteLine(" {0}", s) Next s Else Console.WriteLine("The LinkedList is empty.") End If End Sub End Class 'This code produces the following output. ' 'The first item in the list is <null>. 'The last item in the list is orange. 'The LinkedList contains: ' red ' orange ' yellow ' orange
using System; using System.Collections; using System.Collections.Generic; public class GenericCollection { public static void Main() { // Create and initialize a new LinkedList. LinkedList<String> ll = new LinkedList<String>(); ll.AddLast( "red" ); ll.AddLast( "orange" ); ll.AddLast( "yellow" ); ll.AddLast( "orange" ); // Display the contents of the LinkedList. if ( ll.Count > 0 ) { Console.WriteLine( "The item in the list is {0}.", ll.First.Value ); Console.WriteLine( "The item in the list is {0}.", ll.Last.Value ); Console.WriteLine( "The LinkedList contains:" ); foreach ( String s in ll ) Console.WriteLine( " {0}", s); } else { Console.WriteLine("The LinkedList is empty."); } } } /* This code produces the following output. The first item in the list is red. The last item in the list is orange. The LinkedList contains: red orange yellow orange */
#using <System.dll> using namespace System; using namespace System::Collections; using namespace System::Collections::Generic; void main() { // Create and initialize a new LinkedList. LinkedList< String^ > ^ ll = gcnew LinkedList< String^ >; ll->AddLast( L"red" ); ll->AddLast( L"orange" ); ll->AddLast( L"yellow" ); ll->AddLast( L"orange" ); // Display the contents of the LinkedList. if ( ll->Count > 0 ) { Console::WriteLine( L"The first item in the list is {0}.", ll->First->Value ); Console::WriteLine( L"The last item in the list is {0}.", ll->Last->Value ); Console::WriteLine( L"The LinkedList contains:" ); for each (String^ s in ll) { Console::WriteLine( L" {0}", s ); } } else { Console::WriteLine( L"The LinkedList is empty." ); } } /* This code produces the following output. The first item in the list is red. The last item in the list is orange. The LinkedList contains: red orange yellow orange */

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- LinkedList コンストラクタのページへのリンク