PrepAway - Latest Free Exam Questions & Answers

Tag: Free public proxy

Whichcode segment should you insert at line 03?

You are creating a Windows Communication Foundation (WCF) service by using Microsoft .NET Framework 3.5.
You add the following code segment to the service.

public interface ICalulatorservice
{
[OperationContract]
[FaultContract(typeOf(ArithmeticException))]
double Divide(double number1, double number2);
[OperationContract]
void DisposeCalculator();
}
[ServiceBehavior(IncludeExceptionDetailInFaults=true)]
public class Calculatorservice : ICalulatorservice
{
public double Divide(double number1, double number2)
{
if (number2 == 0) throw new DivideByZeroException();
return (number1 / number2);
}
public void DisposeCalculato()
{
// release resources.
}
}

You add the following code segment to the client application.

01 public double PerformCalculations (double num1, double num2)
02 {
03
04 }

You need to ensure that the DisposeCalculator operation is always called. Which
code segment should you insert at line 03?