Depending on the features of WebClient you need to consider implementing MyWebClient as a proxy server that provides only those methods that you allow to use from a member of WebClient .
Example:
public class MyWebClient { private WebClient HiddenWebClient {get; set;}
After that, you will need a dedicated ctor and possibly a factory to properly create MyWebClient .
This will not prevent your developers from using WebClient , which would be too complicated (see, for example, the @gdoron suggestion), but will help to avoid using it by mistake.
Edit:
From your last comment, I think that all you need is a factory that will install the User Agent for all your WebClient instances.
Then, depending on your organization, you will need a strong usage message (and perhaps a search tool to find new WebClient() in your projects).
public static class WebClientFactory { public static WebClient Create() { WebClient result = new WebClient(); result.Headers.Add("My Fancy User Agent"); return result; } }
remio source share