LinkedList コンストラクタとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > LinkedList コンストラクタの意味・解説 

LinkedList コンストラクタ (ジェネリック IEnumerable)

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

指定した IEnumerable からコピーした要素格納しコピーされる要素の数を格納できるだけの容量備えたLinkedList クラス新しインスタンス初期化します。

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

Public Sub New ( _
    collection As IEnumerable(Of T) _
)
public LinkedList (
    IEnumerable<T> collection
)
public:
LinkedList (
    IEnumerable<T>^ collection
)
public LinkedList (
    IEnumerable<T> collection
)

パラメータ

collection

新しLinkedList要素コピーされた IEnumerable。

例外例外
例外種類条件

ArgumentNullException

collectionnull 参照 (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
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

LinkedList コンストラクタ


LinkedList コンストラクタ (SerializationInfo, StreamingContext)

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

指定した SerializationInfoStreamingContext使用してシリアル化可能な LinkedList クラス新しインスタンス初期化します。

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

Protected Sub New ( _
    info As SerializationInfo, _
    context As StreamingContext _
)
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
)
protected function LinkedList (
    info : SerializationInfo, 
    context : StreamingContext
)

パラメータ

info

LinkedListシリアル化するために必要な情報格納している System.Runtime.Serialization.SerializationInfo オブジェクト

context

LinkedList関連付けられているシリアル化ストリームソースおよびデスティネーション格納している System.Runtime.Serialization.StreamingContext オブジェクト

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

LinkedList コンストラクタ ()

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

LinkedList クラス新しい空のインスタンス初期化します。

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

解説解説
使用例使用例

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
*/

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「LinkedList コンストラクタ」の関連用語

LinkedList コンストラクタのお隣キーワード
検索ランキング

   

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



LinkedList コンストラクタのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS