Search code examples
c#wcfsilverlightservice-reference

Service reference only async and completed methods are shown. why?


I have defined new method in IFoo:

[OperationContract]
List<string> GetChatSubjects(string siteId);

and defined this method in FooReferece.svc.cs

public List<string> GetChatSubjects(string siteId)
{
  ...  
  return List<string>;
}

When I try to get this reference only

  • void GetChatSubjectsAsync();
  • EventHandler GetChatSubjectsCompleted();

methods are shown in my service reference. I need GetChatSubjects() method which return List. I need method's itself. Why only listed methods are shown above?

By the way, my project in Silverlight.


Solution

  • WEll because Silverlight supports only async calls. The reason is that silverlight runs on the browser UI thread. and sync call will block the UI till the callback is received.