Identifying the Two Basic Types of Errors

Essentially, two types of errors can occur in code: compile errors and runtime errors. A compile error (commonly called a build error) is an error in code that prevents Visual C# .NET's compiler from being able to process the code. Visual C# .NET won't compile a project that has a build error in it. A method call with incorrect parameters, for example, will generate a build error. Runtime errors are errors that don't occur at compile time but are encountered when the project is being run. Runtime errors are usually a result of trying to perform an invalid operation on a variable.

For example, the following code won't generate a compile error:

intResult = 10 / intSomeOtherVariable;

Under most circumstances, ...

Get Sams Teach Yourself Microsoft® Visual C#™ .NET in 24 Hours now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.