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



LinkedListNode を作成して LinkedList に追加し、LinkedList が変更された場合に、プロパティ値を追跡するコード例を次に示します。
Imports System Imports System.Collections.Generic Public Class GenericCollection Public Shared Sub Main() ' Create a new LinkedListNode of type String and displays its properties. Dim lln As New LinkedListNode(Of String)("orange") Console.WriteLine("After creating the node ....") DisplayProperties(lln) ' Create a new LinkedList. Dim ll As New LinkedList(Of String) ' Add the "orange" node and display its properties. ll.AddLast(lln) Console.WriteLine("After adding the node to the empty LinkedList ....") DisplayProperties(lln) ' Add nodes before and after the "orange" node and display the "orange" node's properties. ll.AddFirst("red") ll.AddLast("yellow") Console.WriteLine("After adding orange and yellow ....") DisplayProperties(lln) End Sub 'Main Public Shared Sub DisplayProperties(lln As LinkedListNode(Of String)) If lln.List Is Nothing Then Console.WriteLine(" Node is not linked.") Else Console.WriteLine(" Node belongs to a linked list with {0} elements.", lln.List.Count) End If If lln.Previous Is Nothing Then Console.WriteLine(" Previous node is null.") Else Console.WriteLine(" Value of previous node: {0}", lln.Previous.Value) End If Console.WriteLine(" Value of current node: {0}", lln.Value) If lln.Next Is Nothing Then Console.WriteLine(" Next node is null.") Else Console.WriteLine(" Value of next node: {0}", lln.Next.Value) End If Console.WriteLine() End Sub 'DisplayProperties End Class 'GenericCollection 'This code produces the following output. ' 'After creating the node .... ' Node is not linked. ' Previous node is null. ' Value of current node: orange ' Next node is null. ' 'After adding the node to the empty LinkedList .... ' Node belongs to a linked list with 1 elements. ' Previous node is null. ' Value of current node: orange ' Next node is null. ' 'After adding orange and yellow .... ' Node belongs to a linked list with 3 elements. ' Value of previous node: red ' Value of current node: orange ' Value of next node: yellow
using System; using System.Collections.Generic; public class GenericCollection { public static void Main() { // Create a new LinkedListNode of type String and displays its properties. LinkedListNode<String> lln = new LinkedListNode<String>( "orange" ); Console.WriteLine( "After creating the node ...." ); DisplayProperties( lln ); // Create a new LinkedList. LinkedList<String> ll = new LinkedList<String>(); // Add the "orange" node and display its properties. ll.AddLast( lln ); Console.WriteLine( "After adding the node to the empty LinkedList ...." ); DisplayProperties( lln ); // Add nodes before and after the "orange" node and display the "orange" node's properties. ll.AddFirst( "red" ); ll.AddLast( "yellow" ); Console.WriteLine( "After adding orange and yellow ...." ); DisplayProperties( lln ); } public static void DisplayProperties( LinkedListNode<String> lln ) { if ( lln.List == null ) Console.WriteLine( " Node is not linked." ); else Console.WriteLine( " Node belongs to a linked list with {0} elements.", lln.List.Count ); if ( lln.Previous == null ) Console.WriteLine( " Previous node is null." ); else Console.WriteLine( " Value of previous node: {0}", lln.Previous.Value ); Console.WriteLine( " Value of current node: {0}", lln.Value ); if ( lln.Next == null ) Console.WriteLine( " Next node is null." ); else Console.WriteLine( " Value of next node: {0}", lln.Next.Value ); Console.WriteLine(); } } /* This code produces the following output. After creating the node .... Node is not linked. Previous node is null. Value of current node: orange Next node is null. After adding the node to the empty LinkedList .... Node belongs to a linked list with 1 elements. Previous node is null. Value of current node: orange Next node is null. After adding orange and yellow .... Node belongs to a linked list with 3 elements. Value of previous node: red Value of current node: orange Value of next node: yellow */

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


LinkedListNode ジェネリック クラス
アセンブリ: System (system.dll 内)


LinkedList コレクションの各要素は、LinkedListNode です。LinkedListNode には、値、その値が属する LinkedList への参照、次のノードへの参照、および前のノードへの参照が格納されます。

LinkedListNode を作成して LinkedList に追加し、LinkedList が変更された場合に、プロパティ値を追跡するコード例を次に示します。
Imports System Imports System.Collections.Generic Public Class GenericCollection Public Shared Sub Main() ' Create a new LinkedListNode of type String and displays its properties. Dim lln As New LinkedListNode(Of String)("orange") Console.WriteLine("After creating the node ....") DisplayProperties(lln) ' Create a new LinkedList. Dim ll As New LinkedList(Of String) ' Add the "orange" node and display its properties. ll.AddLast(lln) Console.WriteLine("After adding the node to the empty LinkedList ....") DisplayProperties(lln) ' Add nodes before and after the "orange" node and display the "orange" node's properties. ll.AddFirst("red") ll.AddLast("yellow") Console.WriteLine("After adding orange and yellow ....") DisplayProperties(lln) End Sub 'Main Public Shared Sub DisplayProperties(lln As LinkedListNode(Of String)) If lln.List Is Nothing Then Console.WriteLine(" Node is not linked.") Else Console.WriteLine(" Node belongs to a linked list with {0} elements.", lln.List.Count) End If If lln.Previous Is Nothing Then Console.WriteLine(" Previous node is null.") Else Console.WriteLine(" Value of previous node: {0}", lln.Previous.Value) End If Console.WriteLine(" Value of current node: {0}", lln.Value) If lln.Next Is Nothing Then Console.WriteLine(" Next node is null.") Else Console.WriteLine(" Value of next node: {0}", lln.Next.Value) End If Console.WriteLine() End Sub 'DisplayProperties End Class 'GenericCollection 'This code produces the following output. ' 'After creating the node .... ' Node is not linked. ' Previous node is null. ' Value of current node: orange ' Next node is null. ' 'After adding the node to the empty LinkedList .... ' Node belongs to a linked list with 1 elements. ' Previous node is null. ' Value of current node: orange ' Next node is null. ' 'After adding orange and yellow .... ' Node belongs to a linked list with 3 elements. ' Value of previous node: red ' Value of current node: orange ' Value of next node: yellow
using System; using System.Collections.Generic; public class GenericCollection { public static void Main() { // Create a new LinkedListNode of type String and displays its properties. LinkedListNode<String> lln = new LinkedListNode<String>( "orange" ); Console.WriteLine( "After creating the node ...." ); DisplayProperties( lln ); // Create a new LinkedList. LinkedList<String> ll = new LinkedList<String>(); // Add the "orange" node and display its properties. ll.AddLast( lln ); Console.WriteLine( "After adding the node to the empty LinkedList ...." ); DisplayProperties( lln ); // Add nodes before and after the "orange" node and display the "orange" node's properties. ll.AddFirst( "red" ); ll.AddLast( "yellow" ); Console.WriteLine( "After adding orange and yellow ...." ); DisplayProperties( lln ); } public static void DisplayProperties( LinkedListNode<String> lln ) { if ( lln.List == null ) Console.WriteLine( " Node is not linked." ); else Console.WriteLine( " Node belongs to a linked list with {0} elements.", lln.List.Count ); if ( lln.Previous == null ) Console.WriteLine( " Previous node is null." ); else Console.WriteLine( " Value of previous node: {0}", lln.Previous.Value ); Console.WriteLine( " Value of current node: {0}", lln.Value ); if ( lln.Next == null ) Console.WriteLine( " Next node is null." ); else Console.WriteLine( " Value of next node: {0}", lln.Next.Value ); Console.WriteLine(); } } /* This code produces the following output. After creating the node .... Node is not linked. Previous node is null. Value of current node: orange Next node is null. After adding the node to the empty LinkedList .... Node belongs to a linked list with 1 elements. Previous node is null. Value of current node: orange Next node is null. After adding orange and yellow .... Node belongs to a linked list with 3 elements. Value of previous node: red Value of current node: orange Value of next node: yellow */

System.Collections.Generic.LinkedListNode


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


LinkedListNode プロパティ
LinkedListNode メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

LinkedListNode メンバ
LinkedList のノードを表します。このクラスは継承できません。
LinkedListNode ジェネリック型で公開されるメンバを以下の表に示します。



名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

- LinkedListNodeのページへのリンク