User Tools

Site Tools


trycatch

This is an old revision of the document!


Try - Catch

The Try - Catch operators are very important, and should be used where an error can occurr, for example if a file that needs to be read does not exist, you are specifying an invalid path, the current user has not the rights to read and so forth - please read the documentation about System.IO.File.ReadAllText() to see what type of exceptions there are.

In classic VO and Win32 applications, you had to check the return value of an operation, and then eventually ask for more details.

The .NET Framework works differently: it produces an exception, and it is the programmers responsability to treat it correctly.

A sample:<code>

trycatch.1517123601.txt.gz · Last modified: 2018/01/28 07:13 by wolfgangriedmann