Evaluate Expression in while

  • Thread starter Thread starter Bagger Vance
  • Start date Start date
B

Bagger Vance

The code below does not work -- but is there a way to do this?

I want to both read a line and

string sline;

StreamReader m_streamReader = new StreamReader(fi);

while(sline=m_streamReader.ReadLine())
Debug.WriteLine(sline);
 
Hello

The expression in a while or if statement must evaluate to a boolean
The following should work

while((sline = m_StreamReader.ReadLine()) != null)

Best regards,
Sherif
 
Back
Top