"Using Trace.WriteLine() is preferable to using Debug.WriteLine() as the Debug version only works in debug builds." Do you agree with this statement? Why?
Provide code for a simple application containing a loop that generates an error after 5000 cycles. Use a breakpoint to enter Break mode just before the error is caused on the 5000th cycle (note: a simple way to generate an error is to attempt to access a nonexistent array element, such as myArray[1000] in an array with a hundred elements).
"finally code blocks only execute if a catch block isn't executed." True or false?
Given the enumeration data type orientation defined below, write an application that uses Structured Exception Handling (SEH) to cast a byte type variable into an orientation type variable in a safe way. Note that you can force exceptions to be thrown using the checked keyword, an example of which is shown below. This code should be used in your application:
enum orientation : byte { north = 1, south = 2, east = 3, west = 4 } myDirection = checked((orientation)myByte);