Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

What should be done exactly when the most obvious class name for a component is taken by a framework? In my case, I need to make a class that describes an HTTP request. Of course, the most common name is "taken" as System.Web.HttpRequest. What should I do? This project will be used in a web context, so I'd really rather not force people to not import the System.Web namespace, or type out all of my class names manually.

What is the usual way of dealing with this? I can come up with this:

  • Prefix class name with a project shortname
  • Try to come up with a different name that means the same thing(I've tried and can't come up with anything)
  • Force users to choose between namespaces
share|improve this question
    
Is it really a generic HTTP request, or is it a request in a specific module? E.g. is it always a request to some API? –  Joachim Sauer Oct 22 '12 at 8:14
    
@JoachimSauer It's sort of a generic HTTP request. I'd like to use the builtin HttpRequest class but Microsoft decided to make it a sealed class and therefore useless for my case –  Earlz Oct 22 '12 at 13:29
    
In what way is it better than the built-in HttpRequest? Maybe you could use that, something like SecureHttpRequest. –  svick Oct 22 '12 at 20:11

1 Answer 1

up vote 5 down vote accepted

You can use the using alias directive to avoid having to disambiguate everywhere, e.g.

using HttpRequest = MyCompany.MyProject.HttpRequest;
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.