C#C
C#3y ago
morry329#

❔ ✅ IndexOutOfRangeException

I just tried to code out a simple app that reads a .csv file (as per screenshot) and displays the content in the columns "state" and "city" . My Main points out an IndexOutOfRangeException, so something is out of the range. But I am lost to find it out now.

static void Main(string[] args)
        {
            var codeSearch = new ZIPCodeSearch();
            codeSearch.Build(new StreamReader(args[0], Encoding.Default)); //ERROR HERE
            
            Console.WriteLine($"Anwendung ZIPCodeSearch");

            string value;
            while ((value = Console.ReadLine()) != "")
            {
                var scanned = codeSearch.Classify(value);
                Console.WriteLine($"Stadt: {codeSearch.Classify(value)} unbekannt");
                Console.WriteLine($"Land:{codeSearch.Classify(value)}");
            }
        }


Could anyone point me in the right direction?
My other classes for this project is here - FYI:
https://github.com/morry239/HashTableRedBook/blob/master/ZIPCodeSearch/ZIPCodeSearch.cs
Bildschirmfoto_2023-02-20_um_17.40.44.png
GitHub
Contribute to morry239/HashTableRedBook development by creating an account on GitHub.
Was this page helpful?