+ 2

returning a list from a method c#

I am working on another challenge. However, I am stuck. I am not sure what I am missing or it's the format for returning a list from a function. I get the response System.Collections.Generic.List`1[System.String]. Please see the attached code. https://code.sololearn.com/cl30G2zqRN61/?ref=app

23rd Feb 2020, 11:02 PM
laura
2 Respostas
+ 1
it's working fine, how do you want the returned list to be printed? it's printing its type name. try List<string> wrd = GetWords(new List<string> {"a", "b", "c", "a", "d" }); Console.WriteLine(wrd[0]); if you want the whole string you either have to join it or iterate over the returned list to print its content.
23rd Feb 2020, 11:28 PM
Bahhaⵣ
Bahhaⵣ - avatar
0
i see, GetWords method return a list, but you try to print it in Main
23rd Feb 2020, 11:31 PM
Taste
Taste - avatar