PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You are creating a Windows Communication Foundation (WCF) service. You do not want to expose the internal implementation at the service layer.
You need to expose the following class as a service named Arithmetic with an operation named Sum.
public class Calculator
{
public int Add(int x, int y)
{
}
}
Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
[ServiceContract(Namespace=”Arithmetic”)]
public class Calculator
{
[OperationContract(Action=”Sum”)]
public int Add(int x, int y)
{

}
}

B.
[ServiceContract(ConfigurationName=”Arithmetic”)]
public class Calculator
{
[OperationContract(Action=”Sum”)]
public int Add(int x, int y)
{

}
}

C.
[ServiceContract(Name=”Arithmetic”)]
public class Calculator
{
[OperationContract(Name=”Sum”)]
public int Add(int x, int y)
{

}
}

D.
[ServiceContract(Name=”Arithmetic”)]
public class Calculator
{
[OperationContract(ReplyAction=”Sum”)]
public int Add(int x, int y)
{

}
}


Leave a Reply