LinkedList.Count プロパティ
アセンブリ: System (system.dll 内)

LinkedList に実際に格納されているノードの数。


Count プロパティを使用するコード例および出力を次に示します。このコード例では、Count プロパティを使用して、リンク リストと同じサイズの配列を作成し、すべてのノードの値を配列の要素 0 で始まる文字列配列にコピーしてから、配列をクリアします。
このコード例および出力は、LinkedList クラスのトピックで取り上げている例の一部分です。
' Create an array, specifying a size one less than the size ' of the linked list, because Visual Basic allocates one ' more element than you specify. Console.WriteLine(vbLf & "Copy the list to an array.") Dim sArray(sentence.Count - 1) As String sentence.CopyTo(sArray, 0) For Each s As String In sArray Console.WriteLine(s) Next ' Release all the nodes. sentence.Clear() <br /><span space="preserve">...</span><br />'Copy the list to an array. 'the 'quick 'brown 'dog 'jumped 'over 'the 'lazy 'rhinoceros
// Create an array with the same number of elements as the // linked list. Console.WriteLine("\nCopy the list to an array."); string[] sArray = new string[sentence.Count]; sentence.CopyTo(sArray, 0); foreach( string s in sArray ) { Console.WriteLine(s); } // Release all the nodes. sentence.Clear(); <br /><span space="preserve">...</span><br />//Copy the list to an array. //the //quick //brown //dog //jumped //over //the //lazy //rhinoceros
// Create an array with the same number of elements as the // linked list. Console::WriteLine("\nCopy the list to an array."); array<String^>^ sArray = gcnew array<String^>(sentence->Count); sentence->CopyTo(sArray, 0); for each( String^ s in sArray ) { Console::WriteLine(s); } // Release all the nodes. sentence->Clear(); <br /><span space="preserve">...</span><br />//Copy the list to an array. //the //quick //brown //dog //jumped //over //the //lazy //rhinoceros

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


Weblioに収録されているすべての辞書からLinkedList.Count プロパティを検索する場合は、下記のリンクをクリックしてください。

- LinkedList.Count プロパティのページへのリンク