This is a migrated thread and some comments may be shown as answers.

Converter Error

1 Answer 50 Views
Code Converter
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Randy
Top achievements
Rank 1
Randy asked on 04 Aug 2011, 04:52 PM
Thanks for the Converter, it normally works great. I found a function that can crash it though and wanted to let you know.

The while line does a variable assignment and then checks to see if it is null. Although correct in C#, it isn't very pretty code.

Thanks Again
Randy

private string LoadData(string fileName)        
{            
  string data = String.Empty;            
  using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication()) {                
    using (IsolatedStorageFileStream isfs = new IsolatedStorageFileStream(fileName, FileMode.Open, isf)) {                    
      using (StreamReader sr = new StreamReader(isfs)) {                        
        string lineOfData = String.Empty;                        
        while ((lineOfData = sr.ReadLine()) != null)                            
          data += lineOfData;                    
        }                
      }            
    }            
  return data;        
}

1 Answer, 1 is accepted

Sort by
0
Todd
Telerik team
answered on 05 Aug 2011, 05:52 PM
Hi Randy,

Thanks for the feedback and code sample. We'll try to use this to help improve the handling of this scenario. Otherwise, we're glad you find the Code Converter useful!

-Todd

Tags
Code Converter
Asked by
Randy
Top achievements
Rank 1
Answers by
Todd
Telerik team
Share this question
or