Why when no data in txt, only a few lines, but you still can't execute the if st

Why when no data in txt, only a few lines, but you still can't execute a if statement?
Help me, thank you
StreamReader reader = new StreamReader("downQQqun.txt", false);
string str = reader.ReadToEnd().ToString().Trim();//When TXT is used when there is no data
reader.Close();
reader.Dispose();

if (str == null || str == "")
{
timer1.Enabled = false;

}

Started by Ailin at February 05, 2016 - 3:19 AM

You have a look to if debugging, execution time, STR value is what?

Posted by Verne at November 24, 2016 - 10:12 PM

With CRLF.

*****************************************************************************
Signature

Posted by dream at December 06, 2016 - 10:21 PM

+10086

Posted by Hobart at December 08, 2016 - 10:57 PM

How to remove CRLF

Posted by Ailin at December 13, 2016 - 11:10 PM

Can write it
, Thank you

Posted by Ailin at December 25, 2016 - 11:59 PM

Remove the str = = null ||

Posted by Barlow at January 01, 2017 - 2:28 AM

+1

Posted by Frances at January 02, 2017 - 1:55 AM

replace

Posted by dream at January 09, 2017 - 12:33 AM

Enter the end is \r\n this thing is not trim () can be removed.

Posted by Randal at January 10, 2017 - 1:23 AM

if (string.IsNullOrWhiteSpace(str))
{
    timer1.Enabled = false; 
}

Posted by Noah at January 14, 2017 - 1:31 AM