Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

Rhett Herring
Rhett Herring
11,008 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
11,008 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

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.