CHECK IF A STREAMREADER CAN READ ANOTHER LINE

Tanuj Kumar

Total Post:134

Points:940
Posted by  Tanuj Kumar
C# 
C#
 1220  View(s)
Ratings:
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?

  1. Pravesh Singh

    Post:412

    Points:2888
    Re: Check if a StreamReader can read another line

    Hi Tanuj,


    Try this:

    String row;

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

        array[i]=row;

    }


Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!