Thursday, October 22, 2009

Follow-Up: Make Web Service Configurable

Base upon the comments of a reader on my last weekly source code posting is that there is an additional 2x ways to set the URL location of a Web Service:

string newUrl = "http://server/path/to.asmx";
MyService service = new MyService();
service.Url = newUrl;

Or in new C# 3.0 you can use object initializers:

string newUrl = "http://server/path/to.asmx";
MyService service = new MyService {Url = newUrl};

I still prefer using a constructor.

No comments: