Assembly : System (dans system.dll)
SyntaxePublic ReadOnly Property Count As Integer
Dim instance As LinkedList(Of T) Dim value As Integer value = instance.Count
public int Count { get; }
public: virtual property int Count { int get () sealed; }
/** @property */ public final int get_Count ()
public final function get Count () : int
Valeur de la propriété
Nombre de n?uds réellement contenus dans LinkedList.
ExempleL'exemple de code et la sortie suivants illustrent la propriété Count. L'exemple de code utilise la propriété Count pour créer un tableau de la même taille que la liste liée, copie les valeurs de tous les n?uds dans le tableau de chaînes en commençant à l'élément 0 du tableau, puis efface le contenu du tableau.
Ce code et cette sortie font partie d'un exemple plus développé fourni pour la classe 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() ...'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(); ...//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(); ...//Copy the list to an array. //the //quick //brown //dog //jumped //over //the //lazy //rhinoceros
Plates-formesWindows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile pour Pocket PC, Windows Mobile pour Smartphone, Windows Server 2003, Windows XP Édition Media Center, Windows XP Professionnel Édition x64, Windows XP SP2, Windows XP Starter Edition
Le .NET Framework ne prend pas en charge toutes les versions de chaque plate-forme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise.
Informations de version
Outils (masquer)
S'enregistrer
Liste des Membres
Qui est en ligne?
FAQ