How should you complete the relevant code?

DRAG DROP
You are developing an application that implements a set of custom exception types. You declare the custom
exception types by using the following code segments:

The application includes a function named DoWork that throws .NET Framework exceptions and custom
exceptions.
The application contains only the following logging methods:

The application must meet the following requirements:
When AdventureWorksValidationException exceptions are caught, log the information by using the static
void Log (AdventureWorksValidationException ex) method.
When AdventureWorksDbException or other AdventureWorksException exceptions are caught, log the
information by using the static void I oq( AdventureWorksException ex) method.
You need to meet the requirements.
How should you complete the relevant code? (To answer, drag the appropriate code segments to the correct
locations in the answer area. Each code segment may be used once, more than once, or not at all. You may
need to drag the split bar between panes or scroll to view content.)
Select and Place:

DRAG DROP
You are developing an application that implements a set of custom exception types. You declare the custom
exception types by using the following code segments:

The application includes a function named DoWork that throws .NET Framework exceptions and custom
exceptions.
The application contains only the following logging methods:

The application must meet the following requirements:
When AdventureWorksValidationException exceptions are caught, log the information by using the static
void Log (AdventureWorksValidationException ex) method.
When AdventureWorksDbException or other AdventureWorksException exceptions are caught, log the
information by using the static void I oq( AdventureWorksException ex) method.
You need to meet the requirements.
How should you complete the relevant code? (To answer, drag the appropriate code segments to the correct
locations in the answer area. Each code segment may be used once, more than once, or not at all. You may
need to drag the split bar between panes or scroll to view content.)
Select and Place:

Answer:



Leave a Reply 1

Your email address will not be published. Required fields are marked *


Swapnil

Swapnil

Above ans is right
public class AdventureWorksException : System.Exception { }
public class AdventureWorksDbException : AdventureWorksException { }
public class AdventureWorksValidationException : AdventureWorksException { }
class Program
{
static void Log(Exception ex)
{
Console.WriteLine(“Exception : ” + ex.Message);
}
static void Log(AdventureWorksException ex)
{
Console.WriteLine(“AdventureWorksException : ” + ex.Message);
}
static void Log(AdventureWorksValidationException ex)
{
Console.WriteLine(“AdventureWorksValidationException : ” + ex.Message);
}

public static void DoWork()
{
//throw new AdventureWorksValidationException();
//throw new AdventureWorksDbException();
throw new AdventureWorksException();

}
static void Main(string[] args)
{
try
{
Program.DoWork();
}
catch (AdventureWorksValidationException ex)
{
Program.Log(ex);
}
catch(AdventureWorksException ex)
{
Program.Log(ex);
}
catch(Exception ex)
{
Program.Log(ex);
}
Console.ReadLine();
}
}