Why am I getting System.Collections.Generic.List`1[System.String] instead of the list’s contents? [duplicate]

It’s not an error, it’s just printing out the list. The default ToString() implementation of List simply prints the name of the type.

I’m guessing you want it to work like in PHP, where you print arrays separated by commas? Try:

string.Join(", ", player.inventory);

Leave a Comment