meat meat

meat meat

  • NA
  • 6
  • 0

overriding the same method without code duplication

Nov 25 2010 2:15 AM
Hi !

I have several web references in my project .
I created a new class that inherit from those web reference class and I override GetWebResponse from each of those web reference class.
For instance
public class UserServiceProxy : .UserService
{
protected override WebRequest GetWebRequest(Uri uri)
{
HttpWebRequest webRequest = (HttpWebRequest)base.GetWebRequest(uri);
webRequest.KeepAlive = false;
webRequest.ProtocolVersion = HttpVersion.Version10;
return webRequest;
}
}
How do it prevent code repetition like this in every proxy class that inherit from the web reference

Thanks

Answers (1)