Which two actions should you perform?

You are writing an application that handles the batch processing of user accounts.
The application assigns network identities for users by calling the following Web service method.

[WebMethod]
public string GetNetworkID(string name)
{ …}

The application calls the Web
service using the following code.

(Line numbers are included for reference only.)
01 void ProcessPeople(List<Person> people) {
02 PersonService serviceProxy = new PersonService();
03 serviceProxy.GetNetworkIDCompleted += new
04 GetNetworkIDCompletedEventHandler(GetNetworkIDCompleted);
05 for (int i = 0; i < people.Count;i++) {
06 …
07 }
08 }
09
10 void GetNetworkIDCompleted(object sender,
11 GetNetworkIDCompletedEventArgs e){
12 Person p = null;
13 …
14 p.NetworkID = e.Result;
15 ProcessPerson(p);
16 }

You need to ensure that the application can use the data supplied by the Web service to update each Person instance. Which two actions should you perform? (Each correct answer
presents part of the solution. Choose two.)

You are writing an application that handles the batch processing of user accounts.
The application assigns network identities for users by calling the following Web service method.

[WebMethod]
public string GetNetworkID(string name)
{ …}

The application calls the Web
service using the following code.

(Line numbers are included for reference only.)
01 void ProcessPeople(List<Person> people) {
02 PersonService serviceProxy = new PersonService();
03 serviceProxy.GetNetworkIDCompleted += new
04 GetNetworkIDCompletedEventHandler(GetNetworkIDCompleted);
05 for (int i = 0; i < people.Count;i++) {
06 …
07 }
08 }
09
10 void GetNetworkIDCompleted(object sender,
11 GetNetworkIDCompletedEventArgs e){
12 Person p = null;
13 …
14 p.NetworkID = e.Result;
15 ProcessPerson(p);
16 }

You need to ensure that the application can use the data supplied by the Web service to update each Person instance. Which two actions should you perform? (Each correct answer
presents part of the solution. Choose two.)

A.
Replace line 06 with the following code segment.serviceProxy.
GetNetworkIDAsync(people[i].FirstName,people[i]);

B.
Replace line 06 with the following code segment.
serviceProxy.GetNetworkIDAsync(people[i].FirstName,null);

C.
Replace line 13 with the following code segment.
p = e.UserState as Person;

D.
Replace line 13 with the following code segment.
p = sender as Person;



Leave a Reply 0

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