Trying to display contents of a list in a console app with WriteLine
c#, wcf
Solution
`Console.Write` is implicitly calling `ToString()` on the object you are trying to print in the Console. Because your type does not override `ToString()` the text being returned is a result of the default implementation of `ToString()` defined by the `Object` class (from which all types derive from).
Rather than passing `i` as an argument to `Console.Write` pass `i.NameOfThePropertyYouWantToOutput`.
Problem
I am trying to display contents of a list in a console app with WriteLine. I am using the following code: ``` using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using TestCLient.ClientTransactionsServiceReference; namespace TestCLient { class Program { static void Main(string[] args) { ClientTransactionsServiceClient client = new ClientTransactionsServiceClient(); List<ClientTransactions> ct = client.GetClientTransactions("9999"); ct.ForEach(i => Console.Write(i)); Console.Read(); } } } ``` I am getting the following output: When I debug, my list (ct) shows that it contains the fields I want displayed. see the following screenshot: I have searched many sources including Stack to get the line of code I'm using to write my list. I'm new to programming and would greatly appreciate your assistance. Thanks