>>while ((fileName = this.PopQueue(path, filter)) != "" && llSuccess) >>{ >> // Do all my stuff here, process each file returned until no more files are returned. >>} >>} >>>
>class test >{ > static void Main(string[] args) > { > string fileName; > bool success = true; > > while ((fileName = PopQueue()) != "" && success) // here it's still null in the debugger - after execution of PopQueue() > { > } > // here it is "" > Console.ReadLine(); > } > static string PopQueue() > { > return ""; > } > > >} >I suspect I was jumping to a conclusion too soon as your comments make sense. I had a breakpoint on the While line and after the break each time i was Stepping Into the PopQueue() method. Whatching the directory I see no more files and PopQueue returns an empty string. After coming back to the while loop I was expecting the fileName to be "" but it was still null. Thus I still have the problem I was trying to figure out. Why do I have an endless loop in this while statement. If the PopQueue method returns an empty string I needed it to exit the loop. I had originally thought it was working, but then discovered the breakpoint continues to hit over and over regardless of the empty string. Any ideas?