✅ Outputting values from a list
When typing in name and age it doesnt display the correct values. Instead it outputs: Program+Person.
10 Replies
please post code with $code instead
To post C# code type the following:
```cs
// code here
```
Get an example by typing
$codegif
in chat
If your code is too long, post it to: https://paste.mod.gg/$codegif
Console.WriteLine(person);
this will call ToString
on person
and the default tostring for an object is to print the class name
you need to override ToString
in your Person classoh okay? I was following a simple tutorial and this is one of the examples
well either you do something like...
or you override the ToString method in your class
thanks!
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity./close