LinkedListNodeとは? わかりやすく解説

LinkedListNode コンストラクタ

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

指定した値を含んだ LinkedListNode クラス新しインスタンス初期化します。

名前空間: System.Collections.Generic
アセンブリ: System (system.dll 内)
構文構文

Dim value As T

Dim instance As New LinkedListNode(Of
 T)(value)
public LinkedListNode (
    T value
)
public:
LinkedListNode (
    T value
)
public LinkedListNode (
    T value
)
public function LinkedListNode (
    value : T
)

パラメータ

value

LinkedListNode に格納する値。

解説解説
使用例使用例

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

*/
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
LinkedListNode ジェネリック クラス
LinkedListNode メンバ
System.Collections.Generic 名前空間

LinkedListNode ジェネリック クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

LinkedListノード表します。このクラス継承できません。

名前空間: System.Collections.Generic
アセンブリ: System (system.dll 内)
構文構文

<ComVisibleAttribute(False)> _
Public NotInheritable Class
 LinkedListNode(Of T)
Dim instance As LinkedListNode(Of
 T)
[ComVisibleAttribute(false)] 
public sealed class LinkedListNode<T>
[ComVisibleAttribute(false)] 
generic<typename T>
public ref class LinkedListNode sealed
J# では、ジェネリックな型およびメソッド使用できますが、新規に宣言することはできません。
JScript では、ジェネリックな型およびメソッド使用できません。

型パラメータ

T

リンク リスト要素の型を示します

解説解説

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.Object
  System.Collections.Generic.LinkedListNode
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
LinkedListNode メンバ
System.Collections.Generic 名前空間

LinkedListNode プロパティ


パブリック プロパティパブリック プロパティ

参照参照

関連項目

LinkedListNode ジェネリック クラス
System.Collections.Generic 名前空間

LinkedListNode メソッド


LinkedListNode メンバ

LinkedListノード表します。このクラス継承できません。

LinkedListNode ジェネリック型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド LinkedListNode 指定した値を含んだ LinkedListNode クラス新しインスタンス初期化します。
パブリック プロパティパブリック プロパティ
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

LinkedListNode ジェネリック クラス
System.Collections.Generic 名前空間



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「LinkedListNode」の関連用語

LinkedListNodeのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



LinkedListNodeのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS