Which operation contract should you use?

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. You create the following service contract.

[ServiceContract]
public interface IMath
{
[OperationContract]
int Add(int num1, int num2);
}

You need to add an operation contract to perform the Add operation asynchronously. Which operation contract should you use?

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. You create the following service contract.

[ServiceContract]
public interface IMath
{
[OperationContract]
int Add(int num1, int num2);
}

You need to add an operation contract to perform the Add operation asynchronously. Which operation contract should you use?

A.
[OperationContract(AsyncPattern=true)]
IAsyncResult BeginAdd(int num1, int num2);
int EndAdd(IAsyncResult res);

B.
[OperationContract]
int BeginAdd(int num1, int num2, AsyncCallback cb, object state);
IAsyncResult EndAdd();

C.
[OperationContract]
IAsyncResult BeginAdd(int num1, int num2);
[OperationContract]
int EndAdd(IAsyncResult res);

D.
[OperationContract(AsyncPattern=true)]
IAsyncResult BeginAdd(int num1, int num2, AsyncCallback cb, object state);
int EndAdd(IAsyncResult res);

Explanation:
http://msdn.microsoft.com/en-us/library/ms734701.aspx



Leave a Reply 0

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