Help with explanation
I have some codes that i find very hard to understand. Can someone help me break it down line by line?
Service1Client client = new Service1Client()开发者_Go百科;
client.getPrimaryListCompleted += new EventHandler<getPrimaryListCompletedEventArgs>(AddPrimaryMarkerGraphics);
client.getPrimaryListAsync();
The first line creates an instance of the class Service1Client
.
The second line hooks up an event handler for the event getPrimaryListCompleted
.
the third line starts an asynchronous request. When there is a response, the getPrimaryListCompleted
will be triggered so that the event handler can use the response.
- Create a new
ServiceClient
called client. - Add an event handler to client so that when Primary List Function is completed the function
AddPrimaryMarkerGraphics
is automatically called. - Call the client function
getPrimaryListAsync()
(Async means that this function will be executed asynchronously ie: on another thread)
This Service1Client client = new Service1Client();
creates a new object of type Service1Client()
which presumably is a client for calling a WCF service.
Then is attaches an event handler which will get called when the client raises the specified event.
The last line starts an asynchroneous service call (means its running in the background on a separate thread). Once that call has completed it probably raises the getPrimaryListCompleted
event so the event handler will be called.
精彩评论