This now contains an update http://marcushammarberg.blogspot.com/2006/11/more-about-generic-webservces.html. Be sure to look it up for a more elegant solution. ====================================================
Yesterday was spent with my nose deep down the documentation of .NET 2.0, pondering poses and headscratching.
But the reward was a quite cool little hack that solved a tricky problem in our solution.
In my current project we’re are using some webservices and these all need to be configured in the same way. These configurations has to do with setting the URL in runtime, using other credentials, caching and maybe other things that we want to be able to do for all webservices.
So what i wanted is a WebServiceCreator with metods that creates the webservices and does the requested configurations. So my first thought was to use generics - and that was right for quite a while.
I created a class WebServiceCreator that has one (and so many overloads...