Programming Language Project

Is there anything from these codes that I’m missing:
Program.cs

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace ProgrammingLanguages
{
  class Program
  {
    static void Main()
    {
      List<Language> languages = File.ReadAllLines("./languages.tsv")
        .Skip(1)
        .Select(line => Language.FromTsv(line))
        .ToList();

      foreach (Language language in languages)
      {
        Console.WriteLine(language.Prettify());

        var langString = languages.Select(s => $"{s.Year}, {s.Name}, {s.ChiefDeveloper}");
        
        foreach (var a in langString)
        {
          Console.WriteLine(a);
        }
      }
    }
  }
}

Language.cs

using System;

namespace ProgrammingLanguages
{
  public class Language
  {
    public static Language FromTsv(string tsvLine)
    {
      string[] values = tsvLine.Split('\t');
      Language lang = new Language(
        Convert.ToInt32(values[0]),
        Convert.ToString(values[1]),
        Convert.ToString(values[2]),
        Convert.ToString(values[3]));
      return lang;
    }

    public int Year
    { get; set; }

    public string Name
    { get; set; }

    public string ChiefDeveloper
    { get; set; }

    public string Predecessors
    { get; set; }

    public Language(int year, string name, string chiefDeveloper, string predecessors)
    {
      Year = year;
      Name = name;
      ChiefDeveloper = chiefDeveloper;
      Predecessors = predecessors;
    }

    public string Prettify()
    {
      return $"{Year}, {Name}, {ChiefDeveloper}, {Predecessors}";
    }
  }
}

Hi. Not sure if you got an answer on it.
I had a similar error. I see that you’re declaring a select inside the foreach, but at each iteration you’d be scanning the entire “languages” dataset.
I found a workaround which is to do before the foreach.

IEnumerable<string> cLangs = languages.Select(s => $"{s.Year}, {s.Name}, {s.ChiefDeveloper}");
 foreach(string clang in cLangs){
      Console.WriteLine(clang);
    }

Not sure it this is “the way” to do it but it works by piggybacking on the interface. :grin: