Author Archives: compitionpoint - Page 25
Stepping Through Your Code
Once you set up breakpoints, you can use certain commands to step through you code line by line. This allows you to carefully examine what each line of code does…
Breakpoints
Breakpoints allow your program to stop at certain points of the execution. You put breakpoints at a location of the code that you want to investigate. Breakpoints will solely be attack…
Debugging Using Visual Studio
Debugging is the process of detecting errors or bugs while your program is running. If you have successfully fixed all the compilation and syntax errors with the help of the Error…
User-Defined Exceptions
You can create your own exceptions. User-defined exceptions must inherit from the Exception base class. We will create another separate class that inherits from the Exception base class. Create a new Console Application and…
Throwing Exceptions
You can throw exceptions anywhere in the program to artificially create an occurrence of an error. Additionally, you can create custom messages if you don’t like the default message of…
Using finally Blocks
Using finally blocks, you can provide a code that will always execute even if exceptions are thrown. We learned that if an exception was thrown inside a try block, all the following codes in…
try and catch Statements
You can handle errors by using a try…catch statement. You wrap the code that you suspect to trigger an error inside a try block. The catch block contains the codes to be executed when an error…
Unhandled Exceptions
Unhandled exceptions are exceptions that were not properly handled by the program causing the program to terminate. We will demonstrate here what will happen if a program detects an exception during…
Exception Handling and Debugging
No matter how good a programmer is, he will always encounter errors or bugs. Testing for errors eats up a large percentage of program development. It would be better if…
String Interpolation
String interpolation or interpolated strings allows you to specify expressions right within a string literal for better readability. The string literal will serve as a template containing interpolation expressions that…