To review the sample code let's go to the virtual machine and open the Visual Studio
again. Open the same solution that you opened in exercise 1 and now open exercise 2 dot CS file.
We only need to examine the GetAFServer function since the other two functions
will have similar implementations following the inheritance principle.
Let's quickly go over the expansion. Here we use the TryParse function to check if user
enters an integer for the index. We then use a simple if-else statement to check
if the index is out of range. Finally we use the ConnectionInfo.IsConnected
method to check if a connection to the AF server can be established. Now expand the
ExportELT function. Here we create the XML writer instance and then use the ExportXML
method to write the contents to an XML file. Let's start debugging right now.
Please make sure you select the exercise 2. This step is very important. Let's click
start. First enter number five again. It will give us the warning and tells
us that 5 is not between zero and one please try again. Let's enter a string.
It will give us another warning: failed to convert test to a number please try again.
After we enter the correct index let's move on. Select turbine efficiency and then select
combustion turbine. The export has been written to the file called Exp-combustion-turbine.XML.
Now please take a minute to think about the answers to the following
questions using your computer science knowledge. Where was this export file
stored and which application can you use to inspect a file for its content?