Home > DeveloperSection > Forums > Check if a StreamReader can read another line
Tanuj Kumar

Total Post:134

Points:940
Posted on    January-31-2014 11:27 PM

 C# C# 
Ratings:


 1 Reply(s)
 933  View(s)
Rate this:

I need to check if a line contains a string before I read it, I want to do this using a while loop something like this

    while(reader.ReadLine() != null)

    {

        array[i] = reader.ReadLine();

    }

This obviously doesen't work, so how can I do this selection?



Pravesh Singh

Total Post:411

Points:2881
Posted on    January-31-2014 11:42 PM

Hi Tanuj,

Try this:

String row;

while((row=reader.ReadLine())!=null){

    array[i]=row;

}



Don't want to miss updates? Please click the below button!

Follow MindStick