Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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

Rhett Herring
PLUS
Rhett Herring
Courses Plus Student 11,023 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
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
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
Courses Plus Student 11,023 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

Ole Vølund Skov Mortensen
Ole Vølund Skov Mortensen
27,842 Points

I also never had double line breaks.... I'm running Visual Studio 2019 with console core, so maybe that's it? I don't know for sure. however but the double line breaks did not appear as in the given example.

William Schultz
William Schultz
2,926 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.