C# Programming Languages Project

[Learn C# | Codecademy]

Hi team

Please can someone post a solution to this project? There is no solution provided with the project and I’m unable to check where I’m going wrong. Getting loads of errors from Step 1 alone (which is unusual).

Here’s what I’ve got for Step 1:

foreach (Language language in languages)




Thank you

You need to make sure you keep the code that is already in the main function of Program.cs:

List<Language> languages = File.ReadAllLines("./languages.tsv")
        .Select(line => Language.FromTsv(line))

Thank you for getting back to me so quickly - I have kept it in there (I just didn’t paste it here as I was only pasting what I had added so far). Apologies for not making that clear.

It works when I put it in. You’re doing in Program.cs, right? Does your output look like this

It doesn’t, just a bunch of errors but it also keeps crashing… I think I’ll reboot everything and try again. Thanks for your help!
If you/anyone has finished the project, it would be good to compare against solution code at the end.

1 Like

Instead of “foreach (Language language in languages)”


“foreach (var language in languages)”

The reason is that each Language contains an int variable and 3 strings, so each component in “language” is not itself a Language.

Hope this works!