//C# System.IO Excepties - IOExceptions Tekst Inlezen Van of Schrijven Naar een Bestand public class IOExceptionsExample { void Main() { string path = "..."; System.IO.StreamReader streamReader; try { streamReader = new System.IO.StreamReader(path); try { streamReader.ReadToEnd(); } catch (System.OutOfMemoryException ex) { } catch (System.IO.IOException ex) { } } catch (System.ArgumentNullException ex) { } catch (System.ArgumentException ex) { } catch (System.IO.FileNotFoundException ex) { } catch (System.IO.DirectoryNotFoundException ex) { } catch (System.IO.IOException ex) { } finally { if ((streamReader != null)) { streamReader.Close(); } } System.IO.StreamWriter streamWriter; try { streamWriter = new System.IO.StreamWriter(path); try { streamWriter.Write("..."); } catch (System.ObjectDisposedException ex) { } catch (System.NotSupportedException ex) { } catch (System.IO.IOException ex) { } } catch (System.UnauthorizedAccessException ex) { } catch (System.ArgumentNullException ex) { } catch (System.ArgumentException ex) { } catch (System.IO.DirectoryNotFoundException ex) { } catch (System.IO.PathTooLongException ex) { } catch (System.IO.IOException ex) { } catch (System.Security.SecurityException ex) { } finally { if ((streamWriter != null)) { streamWriter.Close(); } } Console.ReadLine(); } } //Bezoek www.vbvoorbeelden.be voor meer C# voorbeelden. //Copyright - De Wolf / vbvoorbeelden - 2003-2010 - Alle rechten voorbehouden.