Hi Guys,
I am trying to cover all my bases here with an application I am creating. As it will be released to the general community I have to account for user error so I am implementing structured error handling. What I want to know is:
A: am I using this correctly
B: if I but the finally block at the end of a method does it skip over any code after the catch block and close the method?
Code:private void OpenFileForReading(string Path) { try { stream = new FileStream(Path, FileMode.Open); reader = new BinaryReader(stream); } catch (Exception e) { ListOfErrors.Add(e.ToString()); } finally { reader.Close(); reader = null; stream.Close(); stream = null; } }




Reply With Quote