When you ToString
an object (which is what Console.WriteLine
does), and it hasn't overridden ToString()
it writes the name of the class. However, you can just use item
which looks like a simple mistake
var myList = new List<int> { 1, 2, 3, 4 };
foreach (var item in myList)
System.Console.WriteLine(item);
// or, you can get fancy with string.Join
Console.WriteLine(string.Join(", ", myList));
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…