C# C# Streams and Data Processing Reading Data Breaking It Up Into Lines

Rhett Herring
PRO
Rhett Herring
Pro Student 7,140 Points

Visual Studio redundant array

Visual studio is telling me this: string[] fileLines = fileContents.Split(new char[] {'\r', '\n'});

Is a redundant explicit array... also I never had double line breaks....

2 Answers

Carling Kirk
STAFF
Carling Kirk
Treehouse Guest Teacher

Hi Rhett! Do you have Resharper installed?

Also - the CSV file provided was accidentally stripped of its double line breaks. It has been replaced with a file that will produce double line breaks as in the video - if you'd like to try it again.

Rhett Herring
Rhett Herring
Pro Student 7,140 Points

I do have ReSharper installed... but running without the array does work fine...

Aaron Selonke
Aaron Selonke
10,323 Points

I don't see the /r sequence in the filecontents..... but strange to me

When I use the split method with /r only as the argument.

string[] fileLines = fileContents.Split(new char[] { '\r' });

the data will separate line by line

William Schultz
William Schultz
2,925 Points

This question was from 7 months ago for me, and the csv file i just downloaded and used only has \n and does not double line break.