Quote Originally Posted by conipto
Code:
public string[] FileToStringArray(string filePath)
{
    string[] outputArray;
    StreamReader sr = new StreamReader(filePath);
    outputArray = sr.ReadToEnd().Split(Environment.NewLine);
    sr.Close();
    return outputArray;
}
Bill
Did you miss my rants about the using statement? ALL C# programmers should be utilizing it. You also do not dispose of your StreamReader.
Quote Originally Posted by steve65
When should a using statement be used, for all objects in a class? From what I read so far I thought it was bad programming to call GC.Collect. I should let the GC collect on its own.
The using statement will only work on classes that are derived from the IDisposable class. Having said that, if it's possible, you should always use the using statement on classes with an IDisposable base. That way you can let it do the cleaning up for you and it makes your application more memory efficient.

Also, calling GC.Collect() is a bit of a bad practice. Since the GC may or may not collect when you call the collect() method, there really is no point in calling it anyway.