cub71 Skrevet 8. januar 2007 Del Skrevet 8. januar 2007 (endret) // Creates and initializes a new ArrayList. ArrayList myAL = new ArrayList(); myAL.Add("Hello"); myAL.Add("World"); myAL.Add("!"); // Displays the properties and values of the ArrayList. Console.WriteLine( "myAL" ); Console.WriteLine( " Count: {0}", myAL.Count ); Console.WriteLine( " Capacity: {0}", myAL.Capacity ); Console.Write( " Values:" ); PrintValues( myAL ); } public static void PrintValues( IEnumerable myList ) { foreach ( Object obj in myList ) Console.Write( " {0}", obj ); Console.WriteLine(); } Kan noen forklare meg hva {0} i denne koden betyr? Litt vanskelig å google ;-) Endret 8. januar 2007 av cub71 Lenke til kommentar
blacktower Skrevet 8. januar 2007 Del Skrevet 8. januar 2007 Console.WriteLine Method (String, Object, Object) This method uses the composite formatting feature of the .NET Framework to convert the value of an object to its text representation and embed that representation in a string. The resulting string is written to the output stream. The format parameter consists of zero or more runs of text intermixed with zero or more indexed placeholders, called format items, that correspond to an object in the parameter list of this method. The formatting process replaces each format item with the text representation of the value of the corresponding object. The syntax of a format item is {index[,alignment][:formatString]}, which specifies a mandatory index, the optional length and alignment of the formatted text, and an optional string of format specifier characters that govern how the value of the corresponding object is formatted. http://msdn2.microsoft.com/en-us/library/aakt1eab.aspx Lenke til kommentar
Manfred Skrevet 9. januar 2007 Del Skrevet 9. januar 2007 ...kunne ikks svart bedre selv. MSDN er alltid en slager når det kommer til .net-programmering. Lenke til kommentar
Anbefalte innlegg
Opprett en konto eller logg inn for å kommentere
Du må være et medlem for å kunne skrive en kommentar
Opprett konto
Det er enkelt å melde seg inn for å starte en ny konto!
Start en kontoLogg inn
Har du allerede en konto? Logg inn her.
Logg inn nå