Aaron Selonke10,323 Points
Why do we need to use the DirectoryInfo class?
There were a lot of new classes that I've not been familar with, so I was researching them one by one.
string currentDirectory = Directory.GetCurrentDirectory(); DirectoryInfo directory = new DirectoryInfo(currentDirectory); var fileName = Path.Combine(directory.FullName, "SoccerGameResults.csv"); var fileContents = ReadFile(fileName);
It looks like in the code we wrote directory.FullName returns a string and is identical to the string currentDirectory.
That is, so far as I can tell, we didn't need to make the DirectoryInfo object at all.
I also notice that there wasn't a need to use the DirectoryInfo class. Although I know that using DirectoryInfo gives us lots of instance methods, they were not used in the video.
Using Directory.GetCurrentDirectory() was sufficient to get the working directory path.
It did confuse/clutter things a bit.