Study Guides (390,000)
CA (150,000)
UofM (800)
COMP (10)

COMP 2150 Study Guide - Final Guide: Common Language Runtime, Compile Time, Computer File

Computer Science
Course Code
COMP 2150
John Anderson
Study Guide

This preview shows half of the first page. to view the full 2 pages of the document.
An object defined using the
dynamic keyword can store anything. In most cases, it behaves like an object. At compile
time, an element that is typed as dynamic is assumed to support any operation.
One form of run-time error is a logic error. Logic errors are normally associated with
programs that run but produce incorrect results. If the application involves a loop, the loop
could be performing one too many or one too few times, producing an incorrect result.
The Debugger provides commands for controlling the execution of your application.
Using the Debugger, you can start or continue execution, break execution, step through an
application, or run to a specific point in your program.You can examine the code while it
is running to validate that the execution path is what you had intended.
Breakpoints are markers that are placed in an application, indicating the program should
halt execution when it reaches that point. When the break occurs, the program and the
Debugger are said to be in break mode. While in break mode, you can examine expressions
to see what values are being generated. If your program is not consistently producing
correct results, this enables you to check intermediate values.
You also have the capability of setting windows during debugging sessions. The
Watch window lets you type in one or more variables or expressions that you want to
observe while the program is running. Unlike the Locals window, which shows all variables
currently in scope, you selectively identify the variables or expressions for the Watch window.
If a program encounters an error such as division by zero during run-time, and the program
cannot recover from the error, it raises or throws an exception.When this happens, execution
halts in the current method and the common language runtime (CLR) attempts to
locate an exception handler to handle the exception. a block of
code that is executed when an exception occurs.
Another important point to make sure you understand is the fact that control is never
returned to the try block after an exception is thrown.The statement that creates a problem
in the try block is the last one tried in the try clause.After control is transferred out of the
try block, no other statements inside the try block are ever executed.
One of the properties of the Exception base class is Message. Message returns a
string describing the exception. Because it is a property of the base class, it can be
used with any exception object. Example 12-4 includes the Exception class in the
argument list for the catch clause.The object identifier e is used to name an object of
that class.The object e can now be used with any of the properties or methods of the
Exception class. The Message property, associated with object e, is used inside
the catch clause to display a message describing the exception.
Following a single try block, you can include multiple catch clauses. This enables you to
write code specific to the thrown exception.When you do this, the order of placement of
You're Reading a Preview

Unlock to view full version