开发者

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.


  1. Create a new ServiceClient called client.
  2. Add an event handler to client so that when Primary List Function is completed the function AddPrimaryMarkerGraphics is automatically called.
  3. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜